ScrollView 不显示 Homefragment 中的所有内容
ScrollView not displaying all Contents in Homefragment
我试图禁用 scrollview 并显示主页中的所有内容,但是直到没有运气滚动没有显示所有 contents.I 已经尝试了所有与此相关的问题但仍然没有运气。如果有人能帮助我,我将不胜感激 me.Thank 你 :)
这里是fragment_home.xml..
<?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:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/bg">
<ProgressBar
android:id="@+id/progressBar"
style="@style/Widget.AppCompat.ProgressBar"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:layout_centerVertical="true"
android:visibility="gone" />
<ScrollView
android:id="@+id/scrollView"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_weight="1" >
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<FrameLayout
android:id="@+id/ContainerSlider"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
<android.support.v7.widget.RecyclerView
android:id="@+id/rv_latest"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="5dp" />
<android.support.v7.widget.RecyclerView
android:id="@+id/rv_featured"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="5dp" />
</LinearLayout>
</ScrollView>
</RelativeLayout>
您的布局可以使用 EPOXY 处理得很好,EPOXY 是 airbnb 的一个库。
会让你的生活轻松很多。
https://github.com/airbnb/epoxy
您尝试添加到 scrollview 了吗
android:fillportView="true"
你也不需要两个 recyclerview.. 一个有多种视图类型。
话虽如此,您也不需要那个滚动视图。您只需要一个具有多种视图类型的 RecyclerView。
您尝试过使用 NestedScrollView
吗?
LinearLayout
的高度也应该是 match_parent
而不是 wrap_content
。
此外,您应该只对 LinearLayout
的子视图使用 weight
,这样您就可以为 NestedScrollView
.
删除它
<NestedScrollView
android:id="@+id/scrollView"
android:layout_width="fill_parent"
android:layout_height="fill_parent" >
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
我试图禁用 scrollview 并显示主页中的所有内容,但是直到没有运气滚动没有显示所有 contents.I 已经尝试了所有与此相关的问题但仍然没有运气。如果有人能帮助我,我将不胜感激 me.Thank 你 :)
这里是fragment_home.xml..
<?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:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/bg">
<ProgressBar
android:id="@+id/progressBar"
style="@style/Widget.AppCompat.ProgressBar"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:layout_centerVertical="true"
android:visibility="gone" />
<ScrollView
android:id="@+id/scrollView"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_weight="1" >
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<FrameLayout
android:id="@+id/ContainerSlider"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
<android.support.v7.widget.RecyclerView
android:id="@+id/rv_latest"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="5dp" />
<android.support.v7.widget.RecyclerView
android:id="@+id/rv_featured"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="5dp" />
</LinearLayout>
</ScrollView>
</RelativeLayout>
您的布局可以使用 EPOXY 处理得很好,EPOXY 是 airbnb 的一个库。 会让你的生活轻松很多。 https://github.com/airbnb/epoxy
您尝试添加到 scrollview 了吗
android:fillportView="true"
你也不需要两个 recyclerview.. 一个有多种视图类型。
话虽如此,您也不需要那个滚动视图。您只需要一个具有多种视图类型的 RecyclerView。
您尝试过使用 NestedScrollView
吗?
LinearLayout
的高度也应该是 match_parent
而不是 wrap_content
。
此外,您应该只对 LinearLayout
的子视图使用 weight
,这样您就可以为 NestedScrollView
.
<NestedScrollView
android:id="@+id/scrollView"
android:layout_width="fill_parent"
android:layout_height="fill_parent" >
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">