ActionBarSherlock标题被裁剪,如何选框?

时间:2013-12-29 09:45:10

标签: android actionbarsherlock label titlebar marquee

使用ActionBarShelock开发了一款应用。由于名字很大,标题正在被裁剪。尝试添加

android:ellipsize="marquee" 
    android:marqueeRepeatLimit="marquee_forever"

但它没有用。请帮忙。

这是androidmanifest文件

<uses-sdk android:minSdkVersion="8"/>

<uses-permission android:name="android.permission.INTERNET"/>
<uses-permission android:name="android.permission.CHANGE_WIFI_STATE" />
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE"/>
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.READ_PHONE_STATE"/>


<application
    android:icon="@drawable/ic_launcher"
    android:label="@string/app_name"
    android:layout_height="wrap_content" 
    android:singleLine="true"
    android:ellipsize="marquee" 
    android:marqueeRepeatLimit="marquee_forever"
    android:theme="@style/Theme.Sherlock" android:debuggable="true">
    <activity android:name="com.rdx.kyanuserinterface.MainActivity" >
        <intent-filter>
            <action android:name="android.intent.action.MAIN" />

            <category android:name="android.intent.category.LAUNCHER" />
        </intent-filter>
    </activity>
    <activity android:name="com.rdx.kyanuserinterface.SingleItemView" >
    </activity>
    <activity android:name="com.rdx.kyanuserinterface.WifiAPClients" >
    </activity>
    <activity android:name="com.rdx.kyanuserinterface.ReadWEPconfiguration" >
    </activity>
</application>

这是附图, enter image description here

1 个答案:

答案 0 :(得分:1)

            int titleId = Resources.getSystem().
            getIdentifier("action_bar_title", "id", "android");
            if(titleId==0)
             titleId=com.actionbarsherlock.R.id.abs__action_bar_title;
             TextView mApptitle=(TextView)findViewById(titleId);
             mApptitle.setEllipsize(TruncateAt.MARQUEE);
                mApptitle.setMarqueeRepeatLimit(1);
                mApptitle.setFocusable(true);
                mApptitle.setFocusableInTouchMode(true);
                mApptitle.requestFocus();
                mApptitle.setSingleLine(true);
                mApptitle.setSelected(true);
                mApptitle.setMarqueeRepeatLimit(-1);