当我将滚动视图添加为线性布局的父级时,回收器视图不可见,其中回收器视图与框架布局和滑动刷新布局一起放置
Recycler view not visible when i add scrollview as a parent of Linear layout where Recycler view is placed with frame layout and swipe refresh layout
当我在 scrollview 或嵌套 scrollview 中放置相同的父项时,不显示 Recyler 视图项。
我的要求是将 scrollview 添加到一半的屏幕,其中包括具有框架布局和滑动刷新布局的 recyclerview。
我已经尝试了 scrollview 和 nestedscrollview,但它没有出现。
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout 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:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_margin="10dp"
android:orientation="vertical">
<RelativeLayout
android:id="@+id/restaurant_list_header"
android:layout_width="wrap_content"
android:layout_height="wrap_content">
<ImageView
android:id="@+id/img_cusine_1"
android:layout_width="fill_parent"
android:layout_height="150dp"
android:layout_alignParentLeft="true"
android:layout_alignParentTop="true"
android:layout_alignParentRight="true"
android:layout_marginLeft="0dp"
android:layout_marginTop="2dp"
android:layout_marginRight="0dp"
android:scaleType="fitXY"
android:src="@drawable/food_1" />
<ImageView
android:id="@+id/arrow_white"
android:layout_width="20dp"
android:layout_height="20dp"
android:layout_alignBottom="@id/img_cusine_1"
android:layout_marginLeft="20dp"
android:layout_marginBottom="30dp"
android:src="@drawable/white_arrow" />
<TextView
android:id="@+id/detail_restaurant_name"
android:layout_width="183dp"
android:layout_height="27dp"
android:layout_alignTop="@+id/arrow_white"
android:layout_alignBottom="@id/img_cusine_1"
android:layout_alignParentEnd="true"
android:layout_alignParentRight="true"
android:layout_marginStart="20dp"
android:layout_marginLeft="31dp"
android:layout_marginTop="-2dp"
android:layout_marginEnd="125dp"
android:layout_marginRight="125dp"
android:layout_marginBottom="30dp"
android:layout_toEndOf="@+id/arrow_white"
android:layout_toRightOf="@+id/arrow_white"
android:text="Restaurant Name"
android:textColor="@color/white"
android:textStyle="bold" />
</RelativeLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
<TextView
android:id="@+id/detail_restaurant_name_sub"
style="@style/RestuarantNames"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentStart="true"
android:layout_alignParentLeft="true"
android:layout_marginStart="8dp"
android:layout_marginLeft="8dp"
android:text="Restuarant Name" />
<TextView
android:id="@+id/detail_restaurant_ratings"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentEnd="true"
android:layout_alignParentRight="true"
android:layout_marginEnd="10dp"
android:layout_marginRight="10dp"
android:background="@color/textGreen"
android:text="3.6"
android:textColor="@color/white"
tools:ignore="RtlHardcoded" />
</RelativeLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<TextView
style="@style/UserLocation"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="2dp"
android:text="@string/detail_retaurant_list_ratings_header" />
<ImageView
android:layout_width="250dp"
android:layout_height="30dp"
android:layout_marginTop="2dp"
android:src="@drawable/rating" />
</LinearLayout>
<View
android:layout_width="match_parent"
android:layout_height="1dp"
android:layout_marginTop="5dp"
android:background="@android:color/darker_gray" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<TextView
style="@style/UserLocation"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="2dp"
android:text="@string/detail_retaurant_list_delivery_place_header" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="5dp"
android:orientation="horizontal">
<ImageView
android:id="@+id/green_arrow"
android:layout_width="25dp"
android:layout_height="25dp"
android:contentDescription="User Location"
android:src="@drawable/icon_user_location"
tools:ignore="HardcodedText" />
<TextView
android:id="@+id/user_address"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="15dp"
android:layout_marginLeft="15dp"
android:layout_marginTop="3dp"
android:layout_marginEnd="146dp"
android:layout_marginRight="146dp"
android:layout_marginBottom="-6dp"
android:text="Rajouri Garden"
android:textStyle="bold"
tools:ignore="HardcodedText" />
<!--<TextView
android:layout_alignParentRight="true"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/user_address_change"
android:text="@string/user_change"
android:layout_marginRight="10dp"
style="@style/User_Green_Font" />-->
</LinearLayout>
<View
android:layout_width="match_parent"
android:layout_height="1dp"
android:layout_marginTop="5dp"
android:background="@android:color/darker_gray" />
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="5dp"
android:text="Delivery in 33 minutes.Live tracking available"
android:textColor="#FF7F50"
android:textStyle="bold" />
<View
android:layout_width="match_parent"
android:layout_height="1dp"
android:layout_marginTop="5dp"
android:background="@android:color/darker_gray" />
<Switch
android:id="@+id/vegSwitch"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="2dp"
android:text="@string/dish_type_veg"
android:textColor="@color/grey"
android:textStyle="bold" />
<TextView
style="@style/HeaderRestuarantsRecommendations"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/dish_type_best_sellers" />
<FrameLayout
android:layout_width="wrap_content"
android:layout_height="match_parent">
<android.support.v4.widget.SwipeRefreshLayout
android:id="@+id/swipe_layout"
android:layout_width="match_parent"
android:layout_height="match_parent">
<android.support.v7.widget.RecyclerView
android:id="@+id/recycler_food_list"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:scrollbars="vertical" />
</android.support.v4.widget.SwipeRefreshLayout>
<com.andremion.counterfab.CounterFab
android:id="@+id/fab"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_alignParentBottom="true"
android:layout_gravity="bottom|end"
android:src="@drawable/ic_shopping_cart_black_24dp"
app:backgroundTint="#3CB371"
tools:ignore="VectorDrawableCompat" />
</FrameLayout>
</LinearLayout>
</LinearLayout>
</LinearLayout>
我需要显示 relativelayout 中的图像,其余内容应该可以在图像下方滚动,包括 recylerview 内容。
现在如果我把滚动视图放在相对布局之后,回收视图内容不会显示,没有滚动视图回收视图列表带有滚动条。
<LinearLayout
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:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_margin="10dp"
android:orientation="vertical">
<RelativeLayout
android:id="@+id/restaurant_list_header"
android:layout_width="wrap_content"
android:layout_height="wrap_content">
<ImageView
android:id="@+id/img_cusine_1"
android:layout_width="fill_parent"
android:layout_height="150dp"
android:layout_alignParentLeft="true"
android:layout_alignParentTop="true"
android:layout_alignParentRight="true"
android:layout_marginLeft="0dp"
android:layout_marginTop="2dp"
android:layout_marginRight="0dp"
android:scaleType="fitXY"
android:src="@drawable/ic_launcher_background" />
<ImageView
android:id="@+id/arrow_white"
android:layout_width="20dp"
android:layout_height="20dp"
android:layout_alignBottom="@+id/img_cusine_1"
android:layout_marginLeft="20dp"
android:layout_marginBottom="30dp"
android:src="@android:drawable/arrow_down_float" />
<TextView
android:id="@+id/detail_restaurant_name"
android:layout_width="183dp"
android:layout_height="27dp"
android:layout_alignTop="@+id/arrow_white"
android:layout_alignBottom="@id/img_cusine_1"
android:layout_alignParentEnd="true"
android:layout_alignParentRight="true"
android:layout_marginStart="20dp"
android:layout_marginLeft="31dp"
android:layout_marginTop="-2dp"
android:layout_marginEnd="125dp"
android:layout_marginRight="125dp"
android:layout_marginBottom="30dp"
android:layout_toEndOf="@+id/arrow_white"
android:layout_toRightOf="@+id/arrow_white"
android:text="Restaurant Name"
android:textColor="@android:color/white"
android:textStyle="bold" />
</RelativeLayout>
<androidx.core.widget.NestedScrollView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fillViewport="true">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<RelativeLayout
android:layout_wienter code heredth="match_parent"
android:layout_height="wrap_content">
<TextView
android:id="@+id/detail_restaurant_name_sub"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentStart="true"
android:layout_alignParentLeft="true"
android:layout_marginStart="8dp"
android:layout_marginLeft="8dp"
android:text="Restuarant Name" />
<TextView
android:id="@+id/detail_restaurant_ratings"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentEnd="true"
android:layout_alignParentRight="true"
android:layout_marginEnd="10dp"
android:layout_marginRight="10dp"
android:background="@android:color/holo_green_dark"
android:text="3.6"
android:textColor="@android:color/white"
tools:ignore="RtlHardcoded" />
</RelativeLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="2dp"
android:text="String text" />
<ImageView
android:layout_width="250dp"
android:layout_height="30dp"
android:layout_marginTop="2dp"
android:src="@android:drawable/btn_radio" />
</LinearLayout>
<View
android:layout_width="match_parent"
android:layout_height="1dp"
android:layout_marginTop="5dp"
android:background="@android:color/darker_gray" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="2dp"
android:text="detail_retaurant_list_delivery_place_header" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="5dp"
android:orientation="horizontal">
<ImageView
android:id="@+id/green_arrow"
android:layout_width="25dp"
android:layout_height="25dp"
android:contentDescription="User Location"
android:src="@android:drawable/btn_radio"
tools:ignore="HardcodedText" />
<TextView
android:id="@+id/user_address"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="15dp"
android:layout_marginLeft="15dp"
android:layout_marginTop="3dp"
android:layout_marginEnd="146dp"
android:layout_marginRight="146dp"
android:layout_marginBottom="-6dp"
android:text="Rajouri Garden"
android:textStyle="bold"
tools:ignore="HardcodedText" />
</LinearLayout>
<View
android:layout_width="match_parent"
android:layout_height="1dp"
android:layout_marginTop="5dp"
android:background="@android:color/darker_gray" />
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="5dp"
android:text="Delivery in 33 minutes.Live tracking available"
android:textColor="#FF7F50"
android:textStyle="bold" />
<View
android:layout_width="match_parent"
android:layout_height="1dp"
android:layout_marginTop="5dp"
android:background="@android:color/darker_gray" />
<Switch
android:id="@+id/vegSwitch"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="2dp"
android:text="dish_type_veg"
android:textColor="@android:color/darker_gray"
android:textStyle="bold" />
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="string/dish_type_best_sellers" />
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent">
<androidx.swiperefreshlayout.widget.SwipeRefreshLayout
android:id="@+id/swipe_layout"
android:layout_width="match_parent"
android:layout_height="match_parent">
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/recycler_food_list"
android:layout_width="match_parent"
android:layout_height="match_parent" />
</androidx.swiperefreshlayout.widget.SwipeRefreshLayout>
<com.google.android.material.floatingactionbutton.FloatingActionButton
android:id="@+id/fab"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_alignParentBottom="true"
android:layout_gravity="bottom|end"
app:backgroundTint="#3CB371"
tools:ignore="VectorDrawableCompat" />
</RelativeLayout>
</LinearLayout>
</LinearLayout>
</androidx.core.widget.NestedScrollView>
我想这会奏效。我将 FrameLayout
更改为 RelativeLayout
,然后将 android:fillViewport="true" 添加到 Nestedscrollview
。现在 recyclerview
似乎是可见的。你可以试试同样的,让我知道它是否有效
当我在 scrollview 或嵌套 scrollview 中放置相同的父项时,不显示 Recyler 视图项。 我的要求是将 scrollview 添加到一半的屏幕,其中包括具有框架布局和滑动刷新布局的 recyclerview。
我已经尝试了 scrollview 和 nestedscrollview,但它没有出现。
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout 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:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_margin="10dp"
android:orientation="vertical">
<RelativeLayout
android:id="@+id/restaurant_list_header"
android:layout_width="wrap_content"
android:layout_height="wrap_content">
<ImageView
android:id="@+id/img_cusine_1"
android:layout_width="fill_parent"
android:layout_height="150dp"
android:layout_alignParentLeft="true"
android:layout_alignParentTop="true"
android:layout_alignParentRight="true"
android:layout_marginLeft="0dp"
android:layout_marginTop="2dp"
android:layout_marginRight="0dp"
android:scaleType="fitXY"
android:src="@drawable/food_1" />
<ImageView
android:id="@+id/arrow_white"
android:layout_width="20dp"
android:layout_height="20dp"
android:layout_alignBottom="@id/img_cusine_1"
android:layout_marginLeft="20dp"
android:layout_marginBottom="30dp"
android:src="@drawable/white_arrow" />
<TextView
android:id="@+id/detail_restaurant_name"
android:layout_width="183dp"
android:layout_height="27dp"
android:layout_alignTop="@+id/arrow_white"
android:layout_alignBottom="@id/img_cusine_1"
android:layout_alignParentEnd="true"
android:layout_alignParentRight="true"
android:layout_marginStart="20dp"
android:layout_marginLeft="31dp"
android:layout_marginTop="-2dp"
android:layout_marginEnd="125dp"
android:layout_marginRight="125dp"
android:layout_marginBottom="30dp"
android:layout_toEndOf="@+id/arrow_white"
android:layout_toRightOf="@+id/arrow_white"
android:text="Restaurant Name"
android:textColor="@color/white"
android:textStyle="bold" />
</RelativeLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
<TextView
android:id="@+id/detail_restaurant_name_sub"
style="@style/RestuarantNames"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentStart="true"
android:layout_alignParentLeft="true"
android:layout_marginStart="8dp"
android:layout_marginLeft="8dp"
android:text="Restuarant Name" />
<TextView
android:id="@+id/detail_restaurant_ratings"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentEnd="true"
android:layout_alignParentRight="true"
android:layout_marginEnd="10dp"
android:layout_marginRight="10dp"
android:background="@color/textGreen"
android:text="3.6"
android:textColor="@color/white"
tools:ignore="RtlHardcoded" />
</RelativeLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<TextView
style="@style/UserLocation"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="2dp"
android:text="@string/detail_retaurant_list_ratings_header" />
<ImageView
android:layout_width="250dp"
android:layout_height="30dp"
android:layout_marginTop="2dp"
android:src="@drawable/rating" />
</LinearLayout>
<View
android:layout_width="match_parent"
android:layout_height="1dp"
android:layout_marginTop="5dp"
android:background="@android:color/darker_gray" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<TextView
style="@style/UserLocation"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="2dp"
android:text="@string/detail_retaurant_list_delivery_place_header" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="5dp"
android:orientation="horizontal">
<ImageView
android:id="@+id/green_arrow"
android:layout_width="25dp"
android:layout_height="25dp"
android:contentDescription="User Location"
android:src="@drawable/icon_user_location"
tools:ignore="HardcodedText" />
<TextView
android:id="@+id/user_address"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="15dp"
android:layout_marginLeft="15dp"
android:layout_marginTop="3dp"
android:layout_marginEnd="146dp"
android:layout_marginRight="146dp"
android:layout_marginBottom="-6dp"
android:text="Rajouri Garden"
android:textStyle="bold"
tools:ignore="HardcodedText" />
<!--<TextView
android:layout_alignParentRight="true"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/user_address_change"
android:text="@string/user_change"
android:layout_marginRight="10dp"
style="@style/User_Green_Font" />-->
</LinearLayout>
<View
android:layout_width="match_parent"
android:layout_height="1dp"
android:layout_marginTop="5dp"
android:background="@android:color/darker_gray" />
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="5dp"
android:text="Delivery in 33 minutes.Live tracking available"
android:textColor="#FF7F50"
android:textStyle="bold" />
<View
android:layout_width="match_parent"
android:layout_height="1dp"
android:layout_marginTop="5dp"
android:background="@android:color/darker_gray" />
<Switch
android:id="@+id/vegSwitch"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="2dp"
android:text="@string/dish_type_veg"
android:textColor="@color/grey"
android:textStyle="bold" />
<TextView
style="@style/HeaderRestuarantsRecommendations"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/dish_type_best_sellers" />
<FrameLayout
android:layout_width="wrap_content"
android:layout_height="match_parent">
<android.support.v4.widget.SwipeRefreshLayout
android:id="@+id/swipe_layout"
android:layout_width="match_parent"
android:layout_height="match_parent">
<android.support.v7.widget.RecyclerView
android:id="@+id/recycler_food_list"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:scrollbars="vertical" />
</android.support.v4.widget.SwipeRefreshLayout>
<com.andremion.counterfab.CounterFab
android:id="@+id/fab"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_alignParentBottom="true"
android:layout_gravity="bottom|end"
android:src="@drawable/ic_shopping_cart_black_24dp"
app:backgroundTint="#3CB371"
tools:ignore="VectorDrawableCompat" />
</FrameLayout>
</LinearLayout>
</LinearLayout>
</LinearLayout>
我需要显示 relativelayout 中的图像,其余内容应该可以在图像下方滚动,包括 recylerview 内容。 现在如果我把滚动视图放在相对布局之后,回收视图内容不会显示,没有滚动视图回收视图列表带有滚动条。
<LinearLayout
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:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_margin="10dp"
android:orientation="vertical">
<RelativeLayout
android:id="@+id/restaurant_list_header"
android:layout_width="wrap_content"
android:layout_height="wrap_content">
<ImageView
android:id="@+id/img_cusine_1"
android:layout_width="fill_parent"
android:layout_height="150dp"
android:layout_alignParentLeft="true"
android:layout_alignParentTop="true"
android:layout_alignParentRight="true"
android:layout_marginLeft="0dp"
android:layout_marginTop="2dp"
android:layout_marginRight="0dp"
android:scaleType="fitXY"
android:src="@drawable/ic_launcher_background" />
<ImageView
android:id="@+id/arrow_white"
android:layout_width="20dp"
android:layout_height="20dp"
android:layout_alignBottom="@+id/img_cusine_1"
android:layout_marginLeft="20dp"
android:layout_marginBottom="30dp"
android:src="@android:drawable/arrow_down_float" />
<TextView
android:id="@+id/detail_restaurant_name"
android:layout_width="183dp"
android:layout_height="27dp"
android:layout_alignTop="@+id/arrow_white"
android:layout_alignBottom="@id/img_cusine_1"
android:layout_alignParentEnd="true"
android:layout_alignParentRight="true"
android:layout_marginStart="20dp"
android:layout_marginLeft="31dp"
android:layout_marginTop="-2dp"
android:layout_marginEnd="125dp"
android:layout_marginRight="125dp"
android:layout_marginBottom="30dp"
android:layout_toEndOf="@+id/arrow_white"
android:layout_toRightOf="@+id/arrow_white"
android:text="Restaurant Name"
android:textColor="@android:color/white"
android:textStyle="bold" />
</RelativeLayout>
<androidx.core.widget.NestedScrollView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fillViewport="true">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<RelativeLayout
android:layout_wienter code heredth="match_parent"
android:layout_height="wrap_content">
<TextView
android:id="@+id/detail_restaurant_name_sub"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentStart="true"
android:layout_alignParentLeft="true"
android:layout_marginStart="8dp"
android:layout_marginLeft="8dp"
android:text="Restuarant Name" />
<TextView
android:id="@+id/detail_restaurant_ratings"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentEnd="true"
android:layout_alignParentRight="true"
android:layout_marginEnd="10dp"
android:layout_marginRight="10dp"
android:background="@android:color/holo_green_dark"
android:text="3.6"
android:textColor="@android:color/white"
tools:ignore="RtlHardcoded" />
</RelativeLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="2dp"
android:text="String text" />
<ImageView
android:layout_width="250dp"
android:layout_height="30dp"
android:layout_marginTop="2dp"
android:src="@android:drawable/btn_radio" />
</LinearLayout>
<View
android:layout_width="match_parent"
android:layout_height="1dp"
android:layout_marginTop="5dp"
android:background="@android:color/darker_gray" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="2dp"
android:text="detail_retaurant_list_delivery_place_header" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="5dp"
android:orientation="horizontal">
<ImageView
android:id="@+id/green_arrow"
android:layout_width="25dp"
android:layout_height="25dp"
android:contentDescription="User Location"
android:src="@android:drawable/btn_radio"
tools:ignore="HardcodedText" />
<TextView
android:id="@+id/user_address"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="15dp"
android:layout_marginLeft="15dp"
android:layout_marginTop="3dp"
android:layout_marginEnd="146dp"
android:layout_marginRight="146dp"
android:layout_marginBottom="-6dp"
android:text="Rajouri Garden"
android:textStyle="bold"
tools:ignore="HardcodedText" />
</LinearLayout>
<View
android:layout_width="match_parent"
android:layout_height="1dp"
android:layout_marginTop="5dp"
android:background="@android:color/darker_gray" />
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="5dp"
android:text="Delivery in 33 minutes.Live tracking available"
android:textColor="#FF7F50"
android:textStyle="bold" />
<View
android:layout_width="match_parent"
android:layout_height="1dp"
android:layout_marginTop="5dp"
android:background="@android:color/darker_gray" />
<Switch
android:id="@+id/vegSwitch"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="2dp"
android:text="dish_type_veg"
android:textColor="@android:color/darker_gray"
android:textStyle="bold" />
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="string/dish_type_best_sellers" />
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent">
<androidx.swiperefreshlayout.widget.SwipeRefreshLayout
android:id="@+id/swipe_layout"
android:layout_width="match_parent"
android:layout_height="match_parent">
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/recycler_food_list"
android:layout_width="match_parent"
android:layout_height="match_parent" />
</androidx.swiperefreshlayout.widget.SwipeRefreshLayout>
<com.google.android.material.floatingactionbutton.FloatingActionButton
android:id="@+id/fab"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_alignParentBottom="true"
android:layout_gravity="bottom|end"
app:backgroundTint="#3CB371"
tools:ignore="VectorDrawableCompat" />
</RelativeLayout>
</LinearLayout>
</LinearLayout>
</androidx.core.widget.NestedScrollView>
我想这会奏效。我将 FrameLayout
更改为 RelativeLayout
,然后将 android:fillViewport="true" 添加到 Nestedscrollview
。现在 recyclerview
似乎是可见的。你可以试试同样的,让我知道它是否有效