Android 滚动很小
我在安卓工作室有个问题。我需要使这个布局滚动,然而,它是滚动非常少 有什么问题吗 到目前为止,我已经尝试了几种解决方案,但都不管用Android 滚动很小,android,Android,我在安卓工作室有个问题。我需要使这个布局滚动,然而,它是滚动非常少 有什么问题吗 到目前为止,我已经尝试了几种解决方案,但都不管用 使用setNestedScrollingEnabled(false)不起作用,因为我正在处理旧的API <?xml version="1.0" encoding="utf-8"?> <ScrollView xmlns:android="http://schemas.android.com/apk/res/android" xmlns:too
使用setNestedScrollingEnabled(false)不起作用,因为我正在处理旧的API
<?xml version="1.0" encoding="utf-8"?>
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="35dp"
android:orientation="vertical"
>
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="39dp"
android:orientation="horizontal">
<one.triangle.me.element.TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginEnd="3dp"
android:layout_marginRight="3dp"
android:id="@+id/element_1"
android:textSize="26sp"
android:layout_gravity="center_vertical"
android:text="•"
/>
</LinearLayout>
<TextView
android:id="@+id/multi_item_selected"
android:layout_width="20dp"
android:layout_height="20dp"
android:layout_alignParentRight="true"
android:layout_alignParentEnd="true"
android:layout_centerVertical="true"
android:src="@drawable/whatever"/>
</RelativeLayout>
</ScrollView>
从ScrollView中删除高度
,因为他们的孩子的高度高于父视图。因此,要么使其包装内容
,要么匹配父项
更新xml代码,如下所示:
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent">
为什么android:layout\u height=“35dp”在ScrollView中“使用setNestedScrollingEnabled(false)不起作用,因为我正在处理旧API”NestedScrollView是支持库的一部分,所以它应该与旧设备兼容。最好的编写方法是什么?android:layou height=“match\u parent”将“高度”设置为“匹配父级”,而不是“静态高度”。以前尝试过此操作,但移动的次数仍然很少。您的内容非常少,可以扩展滚动条的高度进行测试,也可以使用ScrollView的fillViewPort属性