Android 固定高度文本视图禁用父滚动视图的滚动

Android 固定高度文本视图禁用父滚动视图的滚动,android,scrollview,textview,Android,Scrollview,Textview,在我的scrollview中,我有一个具有多行的textview,因为在代码中文本的最大字符数设置为200,所以我希望始终显示textview中的所有文本,因为最多只有6行文本 但问题是,当我触摸多行文本视图时,它会禁用其父对象的滚动。我想触摸文本视图并滚动它,然后屏幕可以上下移动,但现在它只是在文本视图中停止,只有我触摸最右边的边缘才能找到滚动条。我试图在这里找到答案,大部分页面都是关于如何在文本视图中添加scrollview的,这与我的情况不同 有什么建议吗 以下是xml: <com.

在我的scrollview中,我有一个具有多行的textview,因为在代码中文本的最大字符数设置为200,所以我希望始终显示textview中的所有文本,因为最多只有6行文本

但问题是,当我触摸多行文本视图时,它会禁用其父对象的滚动。我想触摸文本视图并滚动它,然后屏幕可以上下移动,但现在它只是在文本视图中停止,只有我触摸最右边的边缘才能找到滚动条。我试图在这里找到答案,大部分页面都是关于如何在文本视图中添加scrollview的,这与我的情况不同

有什么建议吗

以下是xml:

<com.example.VerticalScrollview      xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/ScrollView01"
android:layout_width="fill_parent"
android:layout_height="fill_parent">
    <LinearLayout 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"
android:orientation="vertical"
android:background="#F7F7F7"
tools:context="com.example.EventDetailActivity">

<LinearLayout
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:orientation="vertical">
    <TextView
        android:id="@+id/eventDescription"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:inputType="textMultiLine"
        android:textColor="@android:color/secondary_text_dark_nodisable"
        android:layout_marginTop="20dp"
        android:typeface="monospace"
        android:layout_marginLeft="@dimen/activity_horizontal_margin"
        android:layout_marginRight="@dimen/activity_horizontal_margin"
        android:layout_marginBottom="20dp"
        android:textStyle="italic"/>

</LinearLayout>

</LinearLayout>
</com.example.VerticalScrollview>


我还没有发布所有的xml,但上面是最重要的,剩下的只是其他线性布局、按钮、文本视图、图像视图等。

通过更改 android:inputType=“textMultiLine” 致: android:maxLines=“8”


它看起来像android:inputType禁用了滚动,尽管仍然不知道为什么会发生这种情况。因为我的文本字符不会超过200个,所以只需将其更改为android:maxLines,问题就解决了。棘手的问题和简单的答案。

发布您的xmlplease@IntelliJAmiya正如所建议的那样,xml已经被广泛使用attached@Penghazi尝试将linearlayout包装到嵌套的ScrollView中instead@MohamedAllam您的意思是将VerticalScrollview更改为nestedscrollview吗?我使用VerticalScrollview的原因是scrollview中仍然有一些列表视图,它们也是可滚动的。VerticalScrollview是“XYZ”在本文中提供的一个类: