Search code examples
androidandroid-layoutandroid-theme

Change background color on emojicon library


I want to use an emoji library, and I found rockerhieu's emojicon library which seems to work great, but I want to change the background of the keyboard to white instead of black, how could I achieve that?

I'm using the Theme.AppCompat.Light.NoActionBar.

Thanks in advance.


Solution

  • Try to:

    Replace keyboard_background_holo.9.png (Black) image to below white 9.patch image in your library drawable folder.
    enter image description here

    OR

    Replace your library layout/emojicons.xml file code with:

    <?xml version="1.0" encoding="utf-8"?>
     <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
        android:background="@android:color/white"
        android:layout_width="match_parent"
        android:layout_height="match_parent">
    
        <LinearLayout
            android:id="@+id/emojis_tab"
            android:layout_width="match_parent"
            android:layout_height="50dip"
            android:layout_alignParentTop="true"
            android:orientation="horizontal"
            android:background="@android:color/black"
            >
    
            <ImageButton
                android:background="@null"
                android:layout_width="0dip"
                android:layout_height="match_parent"
                android:layout_weight="1"
                android:scaleType="center"
                android:id="@+id/emojis_tab_0_recents"
                android:src="@drawable/ic_emoji_recent_light" />
    
            <View
                android:layout_width="1px"
                android:layout_height="match_parent"
                android:background="@color/horizontal_vertical" />
    
            <ImageButton
                android:background="@null"
                android:layout_width="0dip"
                android:layout_height="match_parent"
                android:layout_weight="1"
                android:scaleType="center"
                android:id="@+id/emojis_tab_1_people"
                android:src="@drawable/ic_emoji_people_light" />
    
            <View
                android:layout_width="1px"
                android:layout_height="match_parent"
                android:background="@color/horizontal_vertical" />
    
            <ImageButton
                android:background="@null"
                android:layout_width="0dip"
                android:layout_height="match_parent"
                android:layout_weight="1"
                android:scaleType="center"
                android:id="@+id/emojis_tab_2_nature"
                android:src="@drawable/ic_emoji_nature_light" />
    
            <View
                android:layout_width="1px"
                android:layout_height="match_parent"
                android:background="@color/horizontal_vertical" />
    
            <ImageButton
                android:background="@null"
                android:layout_width="0dip"
                android:layout_height="match_parent"
                android:layout_weight="1"
                android:scaleType="center"
                android:id="@+id/emojis_tab_3_objects"
                android:src="@drawable/ic_emoji_objects_light" />
    
            <View
                android:layout_width="1px"
                android:layout_height="match_parent"
                android:background="@color/horizontal_vertical" />
    
            <ImageButton
                android:background="@null"
                android:layout_width="0dip"
                android:layout_height="match_parent"
                android:layout_weight="1"
                android:scaleType="center"
                android:id="@+id/emojis_tab_4_cars"
                android:src="@drawable/ic_emoji_places_light" />
    
            <View
                android:layout_width="1px"
                android:layout_height="match_parent"
                android:background="@color/horizontal_vertical" />
    
            <ImageButton
                android:background="@null"
                android:layout_width="0dip"
                android:layout_height="match_parent"
                android:layout_weight="1"
                android:scaleType="center"
                android:id="@+id/emojis_tab_5_punctuation"
                android:src="@drawable/ic_emoji_symbols_light" />
    
            <View
                android:layout_width="1px"
                android:layout_height="match_parent"
                android:background="@color/horizontal_vertical" />
    
            <ImageButton
                android:background="@null"
                android:layout_width="0dip"
                android:layout_height="match_parent"
                android:layout_weight="1"
                android:id="@+id/emojis_backspace"
                android:src="@drawable/sym_keyboard_delete_holo_dark" />
        </LinearLayout>
    
        <android.support.v4.view.ViewPager
            android:layout_below="@id/emojis_tab"
            android:id="@+id/emojis_pager"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_alignParentBottom="true" />
    
        <View
            android:layout_width="match_parent"
            android:layout_height="1px"
            android:layout_below="@id/emojis_tab"
            android:background="@color/horizontal_divider" />
    </RelativeLayout>