【发布时间】:2016-12-22 18:55:38
【问题描述】:
我想利用 API 21 中添加的新 NestedScroll 功能。 我的布局很简单:
水平滚动视图 LinearLayout(显然是水平的) 常规视图 水平滚动视图 文本视图
默认情况下,nestedScrollEnabled 为 false。所以我在 xml 中为我想要滚动到根 HorizontalScrollView 的子项(例如内部 HorizontalScrollView)启用了它。 因此它什么也不做。只有顶部的滚动视图可以滚动,内部的似乎根本看不到任何滚动触摸事件。
<?xml version="1.0" encoding="utf-8"?>
<HorizontalScrollView xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/scrollView1"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context="com.majeur.test.MainActivity">
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="match_parent">
<HorizontalScrollView
android:id="@+id/scrollView2"
android:layout_width="200dp"
android:layout_height="match_parent"
android:nestedScrollingEnabled="true">
<TextView
android:layout_width="250dp"
android:layout_height="match_parent"
android:text="@string/text" />
</HorizontalScrollView>
<View
android:layout_width="200dp"
android:layout_height="match_parent"
android:background="@color/colorAccent"/>
</LinearLayout>
</HorizontalScrollView>
这是它应该工作的 wau,我不明白...... 谢谢
【问题讨论】:
-
你找到解决办法了吗?
标签: android scrollview horizontalscrollview nestedscrollview android-nestedscrollview