AppBarLayout and Toolbar invisible on Android 4.x -
i using new appbarlayout , toolbar v22 design support library. appear invisible on 4.x devices. known issue? how fix it?
here's xml:
<android.support.design.widget.appbarlayout android:id="@+id/appbar" android:layout_width="match_parent" android:layout_height="wrap_content" android:theme="@style/themeoverlay.appcompat.dark.actionbar"> <android.support.v7.widget.toolbar android:id="@+id/toolbar" android:layout_width="match_parent" android:layout_height="?attr/actionbarsize" android:background="?attr/colorprimary" app:title="insight source" app:popuptheme="@style/themeoverlay.appcompat.light" app:layout_scrollflags="scroll|enteralways"/> </android.support.design.widget.appbarlayout>
they're in relativelayout. moving them coordinatorlayout did not fix issue.
the appbarlayout , toolbar there, since there 'shade' when pull underlying scrollview, invisible.
my full layout:
<relativelayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto" android:id="@+id/main_content" android:layout_width="match_parent" android:layout_height="match_parent"> <android.support.design.widget.appbarlayout android:id="@+id/setting_appbar" android:layout_width="match_parent" android:layout_height="wrap_content"> <android.support.v7.widget.toolbar android:id="@+id/setting_toolbar" android:layout_width="match_parent" android:layout_height="50dp" android:background="#fff" app:title="insight source" /> </android.support.design.widget.appbarlayout> <imageview android:layout_width="match_parent" android:layout_height="match_parent" android:id="@+id/setting_bg_img" android:layout_centervertical="true" android:layout_centerhorizontal="true" android:src="@drawable/baseimg" android:scaletype="centercrop" /> <scrollview android:layout_width="match_parent" android:layout_height="match_parent" android:layout_below="@+id/setting_appbar" > <linearlayout android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="vertical" android:padding="10dp"> <com.devspark.robototextview.widget.robototextview android:id="@+id/login_insight_label" android:layout_width="wrap_content" android:layout_height="wrap_content" app:typeface="roboto_thin" android:text="insight source" android:textsize="40dp" android:textcolor="#fff" android:layout_margintop="20dp" android:layout_gravity="center_horizontal" /> <com.devspark.robototextview.widget.robototextview android:id="@+id/login_companion_label" android:layout_width="wrap_content" android:layout_height="wrap_content" app:typeface="roboto_thin" android:text="companion app" android:textsize="20dp" android:layout_margintop="6dp" android:textcolor="#fff" android:layout_below="@id/login_insight_label" android:layout_gravity="center_horizontal" /> <!-- invisible view margin --> <view android:layout_width="match_parent" android:layout_height="30dp" /> <include android:id="@+id/setting_card_driver" layout="@layout/include_setting_card" /> <!-- invisible view margin --> <view android:layout_width="match_parent" android:layout_height="30dp" /> <include android:id="@+id/setting_card_vehicle" layout="@layout/include_setting_card" /> <!-- invisible view margin --> <view android:layout_width="match_parent" android:layout_height="30dp" /> <relativelayout android:layout_width="match_parent" android:layout_height="wrap_content" android:padding="10dp" android:background="#fff" > <com.devspark.robototextview.widget.robototextview android:id="@+id/setting_info_label" android:layout_width="wrap_content" android:layout_height="wrap_content" app:typeface="roboto_regular" android:text="deze instellingen kunt u aanpassen in insight source" android:textsize="13dp" android:layout_margintop="6dp" android:textcolor="@color/insight_antraciet" android:layout_centerinparent="true" /> </relativelayout> <button android:id="@+id/setting_logout_button" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_margintop="20dp" android:text="log uit" android:theme="@style/buttonstyle" android:textcolor="#fff" android:layout_marginbottom="5dp"/> </linearlayout> </scrollview> </relativelayout>
i have tried placing appbarlayout in coordinatorlayout did not solve problem.
why using theme on appbarlayout
? if remove toolbar
appear again. can move theme toolbar:
app:theme="@style/themeoverlay.appcompat.dark.actionbar"
edit
add imageview:
android:layout_below="@id/setting_appbar"
your imageview
above toolbar
that's why couldn't see it. 1 other thing put toolbar
@ bottom of layout appears above imageview
.
Comments
Post a Comment