Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- getSupportActionBar().setDisplayOptions(ActionBar.DISPLAY_SHOW_CUSTOM);
- getSupportActionBar().setCustomView(R.layout.abs_layout);
- <?xml version="1.0" encoding="utf-8"?>
- <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
- android:layout_width="match_parent"
- android:layout_height="wrap_content"
- android:orientation="vertical" >
- <TextView
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:layout_gravity="center"
- android:text="my Title"
- android:textColor="#ffffff"
- android:id="@+id/mytext"
- android:textSize="18sp" />
- </LinearLayout>
- getSupportActionBar().setBackgroundDrawable(getResources().getDrawable(R.drawable.yourimage)
- <?xml version="1.0" encoding="utf-8"?>
- <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
- android:layout_width="match_parent"
- android:layout_height="match_parent"
- android:orientation="horizontal"
- android:layout_weight="6"
- android:background="@android:color/transparent"
- >
- <RelativeLayout
- android:layout_width="0dp"
- android:layout_height="match_parent"
- android:layout_weight="5"
- android:background="@android:color/transparent"
- >
- <TextView
- android:layout_width="match_parent"
- android:layout_height="wrap_content"
- android:layout_centerInParent="true"
- android:id="@+id/action_bar_title"
- android:text="@string/app_name"
- android:gravity="center_horizontal"
- android:textColor="@android:color/white"
- android:textAllCaps="false"
- android:textStyle="bold"
- android:textAppearance="?android:textAppearanceMedium"
- />
- </RelativeLayout>
- <RelativeLayout
- android:layout_width="0dp"
- android:layout_height="match_parent"
- android:layout_weight="1"
- android:visibility="invisible"
- >
- <Button
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:text="sfsdf"
- android:layout_centerVertical="true"/>
- </RelativeLayout>
- </LinearLayout>
- getSupportActionBar().setDisplayOptions(ActionBar.DISPLAY_SHOW_CUSTOM);
- getSupportActionBar().setCustomView(R.layout.abs_layout);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement