0
这是TextView的XML代码。但是,每当一条线走出屏幕时,我都无法水平滚动。为什么我不能在textview上启用水平滚动?
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/activity_bleapp"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context="com.inti.cmnb.bleapp.BLEApp">
<HorizontalScrollView xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:id="@+id/scrollLogger"
>
<TextView
android:id="@+id/logger"
android:layout_width="fill_parent"
android:layout_height="match_parent"
android:layout_above="@+id/btnTester"
android:scrollHorizontally="true"
android:focusable="true"
android:focusableInTouchMode="true"
android:layout_alignParentTop="true" />
</HorizontalScrollView>
<Button
android:id="@+id/btnTester"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_toEndOf="@+id/scrollLogger"
android:text="SCAN"
android:layout_alignParentStart="true" />
</RelativeLayout>
现在加入HorizontalScrollView后,它不仅水平滚动,宽度非常小,所以我可以看到更少的文本。
检查此链接: - http://stackoverflow.com/a/14098053/3946958 –
textView不会在其视图中应用滚动,所以它不会工作。你需要使用horizontalScrolvIew –
我已经看过所有这些答案。他们都没有工作。我会发布我的整个XML也许有一个问题。 – aarelovich