android - How to set TabLayout transparent keeping my icons and text white -
this first question here i´ve researched lot before. i´m new android development , trying design custom login/signing activity based on new viewpager , tablayouts. thing i´m trying set transparency background 2 tabs appbarlayout , can´t find works me. i´ve tried lots of posted solutions , no 1 seems fit case. last 1 posted here:
how set tablayout background transparent
but nothing, better can this: transparent background try
here layout code gets this:
<?xml version="1.0" encoding="utf-8"?> <linearlayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto" android:orientation="vertical" android:layout_width="match_parent" android:layout_height="match_parent"> <imageview android:layout_width="match_parent" android:layout_height="200dp" android:id="@+id/imageview2" android:layout_gravity="left|center_horizontal" android:background="#f2a0ef" android:contentdescription="@string/logdesc" /> <relativelayout android:layout_width="340dp" android:layout_height="match_parent" android:layout_gravity="top|center_horizontal" android:layout_margintop="-102dp" android:theme="@style/mymaterialtheme" android:layout_marginbottom="80dp" android:transitiongroup="false"> <android.support.design.widget.appbarlayout android:id="@+id/appbarlayout" android:layout_width="match_parent" android:layout_height="wrap_content" android:theme="@style/themeoverlay.appcompat.dark.actionbar" android:background="@android:color/transparent"> <android.support.design.widget.tablayout android:id="@+id/tabs" android:layout_width="match_parent" android:layout_height="@dimen/custom_tab_layout_height" app:tabmode="fixed" app:tabgravity="fill" app:tabindicatorcolor="@color/colorprimary" app:tabindicatorheight="4dp" android:background="@android:color/transparent" /> </android.support.design.widget.appbarlayout> <android.support.v4.view.viewpager android:id="@+id/viewpager" android:layout_width="match_parent" android:layout_height="match_parent" app:layout_behavior="@string/appbar_scrolling_view_behavior" android:layout_alignparentend="false" android:layout_alignparentstart="false" android:layout_below="@+id/appbarlayout" android:background="#ffffff" /> </relativelayout> </linearlayout>
i think activity code not needed, if so, tell me please. thing i´ve effect surrounding tabs not desired of course. i´m stuck , don´t want keep doing things before done. in advance!!
use tablayout outside appbarlayout
<android.support.design.widget.appbarlayout android:id="@+id/appbarlayout" android:layout_width="match_parent" android:layout_height="wrap_content" android:theme="@style/themeoverlay.appcompat.dark.actionbar" android:background="@android:color/transparent" > </android.support.design.widget.appbarlayout> <android.support.design.widget.tablayout android:id="@+id/tabs" android:layout_width="match_parent" android:layout_height="@dimen/custom_tab_layout_height" app:tabmode="fixed" app:tabgravity="fill" app:tabindicatorcolor="@color/colorprimary" app:tabindicatorheight="4dp" android:background="@android:color/transparent" />
Comments
Post a Comment