請看看下面的代碼文字跑馬燈不工作
<TableRow
android:id="@+id/tableRow13"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:padding="5dp" >
<TextView
android:id="@+id/textView22"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="#ffffff"
android:textSize="12sp"
android:text="@string/r_new_event"
android:layout_marginLeft="5dp"
android:textAppearance="?android:attr/textAppearanceSmall" />
<TextView
android:id="@+id/textView23"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Meeting with people i have never seen before in my entire life lol"
android:ellipsize="marquee"
android:maxLength="10"
android:singleLine="true"
android:fadingEdge="horizontal"
android:marqueeRepeatLimit="marquee_forever"
android:scrollHorizontally="true"
android:textColor="#ffffff"
android:textSize="12sp"
android:layout_marginLeft="10dp"
android:textAppearance="?android:attr/textAppearanceSmall" />
</TableRow>
這個嘗試是框選文字,如果超過10個字母長。但不幸的是,這段代碼不起作用。我嘗試了飛蛾模擬器和Android手機。這裏有什麼問題?
更新
以下是我新的代碼,它仍然沒有工作
<TextView
android:id="@+id/textView23"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Meeting with people i have never seen before in my entire life lol"
android:ellipsize="marquee"
android:maxLength="10"
android:singleLine="true"
android:fadingEdge="horizontal"
android:marqueeRepeatLimit="marquee_forever"
android:scrollHorizontally="true"
android:textColor="#ffffff"
android:textSize="12sp"
android:layout_marginLeft="10dp"
android:focusable="true"
android:focusableInTouchMode="true"
android:freezesText="true"
android:textAppearance="?android:attr/textAppearanceSmall" />
我認爲你必須有重點的TextView爲它選取框以及 – kabuto178
檢查:http://stackoverflow.com/questions/3332924/textview-marquee-not-working和http://developer-dot-android.blogspot.in/2012/03/marquee-effect-in-textview-tutorial.html –
@androiduser:令人驚訝的事實是,這也是行不通的! –