我在视图寻呼机内使用的片段中使用Scroll View。但滚动似乎不起作用。
<ScrollView
android:id="@+id/scrollview"
android:layout_width="match_parent"
android:layout_height="match_parent"
>
<android.support.percent.PercentRelativeLayout
android:id="@+id/container"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
>
...
...
...
</android.support.percent.PercentRelativeLayout>
</ScrollView>
这是片段的布局。但滚动似乎根本不起作用。
答案 0 :(得分:0)
试试这个
scrollview.setOnTouchListener(new View.OnTouchListener() {
@Override
public boolean onTouch(View v, MotionEvent event) {
v.getParent().requestDisallowInterceptTouchEvent(true);
return false;
}
});
答案 1 :(得分:0)
您可以尝试使用&#34; wrap_parent&#34;在&#34; scrollview&#34;及其子视图:
机器人:layout_height =&#34; wrap_parent&#34;
答案 2 :(得分:0)
使滚动视图顶部(即父级)具有填充父级高度和宽度。
答案 3 :(得分:0)
使用NestedScrollView,如下所示:
<android.support.v4.widget.NestedScrollView xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/scroll"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:layout_behavior="@string/appbar_scrolling_view_behavior"
tools:context=".FragmentContactInfo">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
</LinearLayout>
</android.support.v4.widget.NestedScrollView>