android - Toolbar and tablaout and fragment to share same background image -
i new android trying display 1 background image tool , tabs , fragment ,i got background image toolbar , tab how show same background image fragment please 1 me how xml code
<android.support.v7.widget.toolbar android:layout_width="match_parent" android:layout_height="wrap_content" android:minheight="?attr/actionbarsize" android:id="@+id/mainactivitybar" android:layout_alignparenttop="true" android:background="@drawable/actionbar" app:contentinsetleft="0dp" app:contentinsetstart="0dp" app:contentinsetend="0dp" app:contentinsetright="0dp" <relativelayout android:layout_width="match_parent" android:layout_height="wrap_content" > <textview android:layout_width="wrap_content" android:layout_height="wrap_content" android:textappearance="?android:attr/textappearancemedium" android:text="president" android:id="@+id/appname_1" android:background="@android:color/transparent" android:textcolor="#ffffff" android:layout_marginleft="20dp" /> <android.support.design.widget.tablayout android:id="@+id/tabs" style="@style/mycustomtablayout" android:layout_width="match_parent" android:layout_height="wrap_content" android:background="@android:color/transparent" android:layout_below="@+id/appname_1" android:layout_alignparentend="true" android:layout_alignparentstart="false" android:layout_alignparentleft="false" android:layout_alignparentright="true" android:layout_alignparentbottom="false" android:layout_alignleft="@+id/appname_1" app:tabgravity="fill" app:tabmode="scrollable"/> </relativelayout>
try following:
set background of tablayout , toolbar transparent. can attribute: android:background="@android:color/transparent"
then set desired background image root view. (in case coordinatorlayout - didn't post full layout).
if need code example let me know, should pretty straightforward.
edit:
as requested code example. it's described above. instead of coordinatorlayout root layout can use of course other layout need.
<?xml version="1.0" encoding="utf-8"?> <android.support.design.widget.coordinatorlayout 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" android:background="@drawable/background"> <android.support.design.widget.appbarlayout android:id="@+id/app_bar_layout" android:layout_width="match_parent" android:layout_height="wrap_content" android:background="@android:color/transparent" android:theme="@style/apptheme.appbaroverlay"> <android.support.v7.widget.toolbar android:id="@+id/toolbar" android:layout_width="match_parent" android:layout_height="?attr/actionbarsize" android:background="@android:color/transparent" app:popuptheme="@style/apptheme.popupoverlay" /> <android.support.design.widget.tablayout android:layout_width="match_parent" android:layout_height="wrap_content" android:background="@android:color/transparent"/> </android.support.design.widget.appbarlayout> </android.support.design.widget.coordinatorlayout> 
Comments
Post a Comment