【问题标题】:Auto Scroll TextView in a CustomListView在 CustomListView 中自动滚动 TextView
【发布时间】:2013-07-03 09:13:34
【问题描述】:

我正在尝试让自定义列表视图中的文本视图滚动。

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:descendantFocusability="blocksDescendants"
android:orientation="horizontal"
android:padding="10dp" >

<TextView
    android:id="@+id/listview_patientname"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_alignParentLeft="true"
    android:layout_alignParentTop="true"
    android:layout_marginTop="26dp"
    android:ellipsize="marquee"
    android:focusable="true"
    android:focusableInTouchMode="true"
    android:hint="Patient Name"
    android:marqueeRepeatLimit="marquee_forever"
    android:minWidth="120dp"
    android:scrollHorizontally="true"
    android:singleLine="true"
    android:textAppearance="?android:attr/textAppearanceSmall" />

以上是我的 xml 代码,我已将列表视图设置为选中。

上面的xml以及设置一个不在listview滚动中的textview。

有解决办法吗?谢谢

【问题讨论】:

    标签: android android-listview scroll textview


    【解决方案1】:

    尝试使用这个:

        <ScrollView
                android:layout_width="fill_parent"
                android:layout_height="fill_parent" >
    
         <RelativeLayout
                android:layout_width="fill_parent"
                android:layout_height="fill_parent" >
    
          </RelativeLayout>
       </ScrollView>
    

    ScrollView 只能包含一个孩子。所以在其中放置另一个布局,然后放置您的视图。

    【讨论】:

    • 您好,我不太明白答案。我必须将我的文本视图放在相对布局中吗?如果有这种情况,我的自定义列表视图中的每个文本视图都需要 1 个滚动视图和布局吗?
    • 将所有视图放在RelativeLayout下的ScrollView中,它们都可以滚动。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2015-03-27
    • 2014-03-09
    • 1970-01-01
    • 2011-07-25
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多