2012-09-21 36 views
0

我有我的ArrayList中&好友列表我試圖使用ArrayAdapter & rowlayout.xml如何將選框效果添加到列表視圖?

<TextView xmlns:android="http://schemas.android.com/apk/res/android" 
android:layout_width="fill_parent" 
android:layout_height="match_parent" 
android:id="@+id/rowlayout" 
android:padding="10dp" 
> 

現在我想添加滾動字幕效果在列表視圖中顯示它它。我想永遠滾動列表視圖此。 爲此,我添加以下代碼

android:ellipsize="marquee" 
android:focusable="true" 
android:focusableInTouchMode="true" 
android:freezesText="true" 
android:marqueeRepeatLimit="marquee_forever" 
android:paddingLeft="15dip" 
android:paddingRight="15dip" 
android:scrollHorizontally="true" 
android:singleLine="true" 

但這個代碼停止的ListView我OnLongClickListner效果。

我不知道爲什麼?

回答

1
android:ellipsize="marquee" 
      android:gravity="left" 
      android:lines="1" 
      android:scrollHorizontally="true" 

安卓SINGLELINE是depricated,可聚焦 - 不是需要太

這種佈局在新的樣本項目工程:

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" 
    xmlns:tools="http://schemas.android.com/tools" 
    android:layout_width="match_parent" 
    android:layout_height="match_parent" > 

    <TextView 
     android:layout_width="fill_parent" 
     android:layout_height="wrap_content" 
     android:layout_centerHorizontal="true" 
     android:layout_centerVertical="true" 
     android:ellipsize="marquee" 
     android:marqueeRepeatLimit="marquee_forever" 
     android:paddingLeft="15dip" 
     android:paddingRight="15dip" 
     android:scrollHorizontally="true" 
     android:text="12312312321321312312321321312311321321321312321312312123132132132" /> 

</RelativeLayout> 
+0

謝謝,但這並不對me.Now OnLongClick工作效果工作,但文字不滾動。 –

+0

檢查更新回答 – Yahor10

+0

是的。它的工作。謝謝。我們可以垂直滾動所有列表項目嗎? –