I want to achieve this:
What I thought was to make a Custom Toolbar with a bigger height and work with the tabhost and tabpager normally. I have implemented it, but the toolbar is showing the normal height, so it doesn't show as I want, just the top part. Is this the right approach or is it possible to set a TabHost below a Linear/Relative Layout? Because I don't need to work with it as an 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 this function in the 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);
}
ActionBar
. Where is yourToolbar
code? You can set the height hereandroid:minHeight="?attr/actionBarSize"
in your XML. Use height and not minHeight. – Deneendenegation