Skip to content

Instantly share code, notes, and snippets.

@ddqd
Created September 2, 2015 13:56
Show Gist options
  • Select an option

  • Save ddqd/0275d413ee00ea5f2788 to your computer and use it in GitHub Desktop.

Select an option

Save ddqd/0275d413ee00ea5f2788 to your computer and use it in GitHub Desktop.
toolbar with custom layout
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@android:color/black"
android:orientation="vertical"
tools:context=".MainActivity">
<android.support.v7.widget.Toolbar
android:id="@+id/toolbar"
android:layout_width="match_parent"
android:layout_height="@dimen/action_bar_default_height_material"
android:background="@drawable/toolbar_background"
android:elevation="4dp"
android:transitionName="actionBar"
app:popupTheme="@style/ThemeOverlay.AppCompat.Dark"
app:theme="@style/AppTheme.Toolbar">
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent" android:layout_height="match_parent"
android:layout_gravity="bottom"
android:gravity="bottom" android:orientation="vertical">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_gravity="center|bottom"
android:gravity="center|bottom"
android:orientation="horizontal"
android:paddingRight="25dp">
<ImageView
android:id="@+id/toolbar_logo"
android:layout_width="@dimen/action_bar_default_height_material"
android:layout_height="@dimen/action_bar_default_height_material"
android:src="@drawable/biglogo"/>
<TextView
android:id="@+id/toolbar_title"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:ellipsize="end"
android:gravity="left|center"
android:maxLines="1"
android:paddingLeft="5dp"
android:textColor="@color/white"
android:textSize="20sp"/>
</LinearLayout>
</LinearLayout>
</android.support.v7.widget.Toolbar>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent">
</LinearLayout>
</LinearLayout>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment