How to set Android toolbar height? -
i want achieve this:

what thought make custom toolbar bigger height , work tabhost , tabpager normally. have implemented it, toolbar showing normal height, doesn't show want, top part. right approach or possible set tabhost below linear/relative layout? because don't need work action bar.
relevant code
toolbar.xml
<?xml version="1.0" encoding="utf-8"?> <android.support.v7.widget.toolbar xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/toolbartitle" android:orientation="vertical" android:background="@color/black" android:layout_width="match_parent" android:fitssystemwindows="true" android:minheight="?attr/actionbarsize" android:theme="@style/apptheme" android:layout_height="wrap_content"> <relativelayout android:layout_width="match_parent" android:layout_height="wrap_content"> <imageview android:id="@+id/img_logo" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_margintop="55dp" android:scaletype="centerinside" android:src="@drawable/logo_home" /> <textview android:id="@+id/txt_version" android:text="@string/app_version" android:textcolor="@color/white" android:layout_below="@+id/img_logo" android:paddingbottom="10dp" android:paddingtop="15dp" android:gravity="center" android:layout_width="match_parent" android:layout_height="wrap_content"/> </relativelayout> </android.support.v7.widget.toolbar> and function in activity:
private void setupactionbar() { actionbar ab = getsupportactionbar(); ab.setdisplayshowcustomenabled(true); ab.setdisplayshowtitleenabled(false); layoutinflater inflator = (layoutinflater) this.getsystemservice(context.layout_inflater_service); view v = inflator.inflate(r.layout.toolbar_title, null); ab.setcustomview(v); }
<android.support.v7.widget.toolbar xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/toolbartitle" android:orientation="vertical" android:background="@color/black" android:layout_width="match_parent" android:fitssystemwindows="true" android:minheight="?attr/actionbarsize" //pay attention here android:theme="@style/apptheme" android:layout_height="wrap_content"> //pay attention here your toolbar viewgroup wraping height around children meaning fixed size if children measured. minimum height around 50 60 dip, how low toolbar be. if children height not add reasonable big number still <= 50
give prefered height android:layout_height="200dp"
Comments
Post a Comment