Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/android/214.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Android文本视图可滚动_Android_Listview_Android Intent_Textview - Fatal编程技术网

Android文本视图可滚动

Android文本视图可滚动,android,listview,android-intent,textview,Android,Listview,Android Intent,Textview,我有一个文本视图,它的大小是16个字符,如果它超过16个字符,我想让用户可以滚动查看剩余的字符。 有人能帮我吗 我试过这个链接 但是没有结果 我的文本视图布局: <TextView android:id="@+id/tv1" android:layout_width="fill_parent" android:layout_height="fill_parent" android:maxLength="16" android:scrol

我有一个文本视图,它的大小是16个字符,如果它超过16个字符,我想让用户可以滚动查看剩余的字符。 有人能帮我吗

我试过这个链接

但是没有结果

我的文本视图布局:

<TextView  
    android:id="@+id/tv1"
    android:layout_width="fill_parent" 
    android:layout_height="fill_parent" 
    android:maxLength="16"
       android:scrollbars = "vertical"
       android:ellipsize="end"
    android:text="fdgdddhhhdhd"
    />

将文本视图包装在滚动视图中:

<ScrollView
    android:layout_width="fill_parent" 
    android:layout_height="fill_parent" >
        <TextView  
            android:id="@+id/tv1"
            android:layout_width="fill_parent" 
            android:layout_height="fill_parent" 
            android:maxLength="16"
            android:scrollbars = "vertical"
            android:ellipsize="end"
            android:text="fdgdddhhhdhd" />
</ScrollView>

您的android:maxlength=“16”将文本视图中可放置的字符数限制为16个


在XML布局文件中:

<TextView
    android:id="@+id/message_scroll"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:scrollbars="vertical"
    android:text="@string/lorem" />

显示您的TextView布局I添加了TextView请检查您是否可以使用:TextView.setMovementMethod(新的ScrollingMovementMethod());使用TextView.setselected(true)。。。这可能是惊人的重复,但我如何可以滚动垂直和水平?
TextView tv = (TextView) rootView.findViewById(R.id.message_scroll);
tv.setMovementMethod(new ScrollingMovementMethod());