Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // JAVA
- ActionBar actionBar = getSupportActionBar();
- if (actionBar != null) {
- actionBar.setDisplayOptions(ActionBar.DISPLAY_SHOW_CUSTOM);
- // Custom ActionBar
- View customView = LayoutInflater.from(this).inflate(
- R.layout.actionbar_title, null);
- TextView tv = (TextView) customView.findViewById(R.id.custom_title);
- tv.setText("基本情報取込");
- // Set ActionBar properties
- ActionBar.LayoutParams params = new ActionBar.LayoutParams(
- ActionBar.LayoutParams.MATCH_PARENT,
- ActionBar.LayoutParams.MATCH_PARENT, Gravity.CENTER);
- actionBar.setCustomView(customView, params);
- actionBar.setDisplayHomeAsUpEnabled(true);
- }
- //XML
- <?xml version="1.0" encoding="utf-8"?>
- <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
- android:layout_width="match_parent"
- android:layout_height="match_parent" >
- <TextView
- android:id="@+id/custom_title"
- android:layout_width="match_parent"
- android:layout_height="match_parent"
- android:gravity="center"
- android:ellipsize="end"
- android:maxLines="1"
- android:textAppearance="?android:attr/textAppearanceMedium"
- android:textColor="@android:color/white" />
- </RelativeLayout>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement