Reputation: 7601
For some screens I use the "android.support.v7.widget.Toolbar" as an bottom toolbar. Works great.
I would like to show a thin border at the top. How to create that border? Below this border (line) the menu items are shown normally / horizontally.
The toolbar could be as simple as this:
<android.support.v7.widget.Toolbar
android:id="@+id/toolbar_bottom"
android:layout_height="wrap_content"
android:layout_width="match_parent"
android:background="@color/white"
android:layout_alignParentBottom="true"
android:minHeight="?attr/actionBarSize">
</android.support.v7.widget.Toolbar>
This border should be configurable as part of the toolbar, because on some actions the bottom toolbar is made invisible (and visible again).
Upvotes: 2
Views: 4566
Reputation: 1710
You can use a simple view above your toolbar, and the whole thing contained in a same layout so you can control visibility
. You can customize the view with color, height etc
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:gravity="bottom"
android:orientation="vertical"
android:id="@+id/container">
<View
android:layout_width="match_parent"
android:layout_height="1dp"
android:background="@android:color/black"
android:id="@+id/view_toolbar" />
<android.support.v7.widget.Toolbar
android:id="@+id/toolbar_bottom"
android:layout_height="wrap_content"
android:background="@android:color/holo_blue_light"
android:layout_width="match_parent"
android:minHeight="?attr/actionBarSize">
</android.support.v7.widget.Toolbar>
</LinearLayout>
And in Java :
RelativeLayout container = (RelativeLayout) findViewById(R.id.container);
if(condition...){
container.setVisibility(View.GONE);
} else {
container.setVisibility(View.VISIBILE);
}
Upvotes: 4