ActionBar (sherlock) のタイトルがトリミングされないようにする方法はありますか (ThisIsMyTi のように...)
常にタイトル全体を表示したいので、ハードウェア メニュー ボタンのないデバイスのオーバーフロー メニュー ボタンを除いて、タイトルは常に最高の優先度を持つ必要があります。
解決策があればいいですね。タイトルの省略サイズを null に設定しても機能しません。
ActionBar (sherlock) のタイトルがトリミングされないようにする方法はありますか (ThisIsMyTi のように...)
常にタイトル全体を表示したいので、ハードウェア メニュー ボタンのないデバイスのオーバーフロー メニュー ボタンを除いて、タイトルは常に最高の優先度を持つ必要があります。
解決策があればいいですね。タイトルの省略サイズを null に設定しても機能しません。
上に追加:
private TextView titleTV;
OnCreate で:
ActionBar Bar=getSupportActionBar();
Bar.setDisplayShowTitleEnabled(false);
LayoutInflater inflater = LayoutInflater.from(this);
View customView = inflater.inflate(R.layout.bar, null);
titleTV = (TextView) customView.findViewById(R.id.title);
titleTV.setSelected(true);
Bar.setCustomView(customView);
Bar.setDisplayShowCustomEnabled(true);
そして、bar.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"
android:background="@android:color/transparent" >
<TextView
android:id="@+id/title"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:textSize="19dp"
android:singleLine="true"
android:duplicateParentState="true"
android:fadingEdge="horizontal"
android:ellipsize="marquee"
android:marqueeRepeatLimit="marquee_forever"
android:scrollHorizontally="true"
android:focusable="true"
android:focusableInTouchMode="true"
android:text="">
<requestFocus
android:duplicateParentState="true"
android:focusable="true"
android:focusableInTouchMode="true" />
</TextView>
</RelativeLayout>
でタイトルを設定できます
titleTV.setText(t);