android - android xml 设计在更大的屏幕设备(如 > 6.0 英寸)的屏幕底部显示更多空间,尤其是在三星 M20 中
问题描述
我RelativeLayout
在主屏幕 xml 设计中使用。在它里面CustomScrollView
显示一个RecyclerView
. 它适用于显示/固定屏幕尺寸的普通屏幕设备,但对于像三星 M20 手机这样的大屏幕设备,它会在屏幕之间显示额外的空间,Recyclerview
请BottomView
注意以下屏幕截图:
这是 XML 代码:
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent">
<com.bocawestcc.cobaltmemberapp.util.CustomScrollView
android:id="@+id/scrollView"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_below="@+id/rr_profileView"
android:fillViewport="true"
android:scrollbars="none" >
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:focusableInTouchMode="true"
android:orientation="vertical">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="100dp"
android:layout_below="@+id/tv_name"
android:background="@color/colorWhite">
<RelativeLayout
android:id="@+id/card_notification"
android:layout_width="match_parent"
android:layout_marginTop="@dimen/default_margin"
android:layout_height="wrap_content">
<ImageView
android:id="@+id/iv_clubNews"
android:layout_width="20dp"
android:layout_height="20dp"
android:layout_centerVertical="true"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp"
android:backgroundTint="@color/colorOrange"
android:scaleType="centerInside"
android:visibility="visible"
android:src="@drawable/clun_news3" />
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_alignParentEnd="true"
android:layout_centerVertical="true"
android:layout_marginLeft="@dimen/default_margin"
android:layout_marginRight="@dimen/default_margin"
android:background="@drawable/text_cta"
android:gravity="center"
android:orientation="horizontal">
<TextView
android:id="@+id/tv_all"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="@dimen/margin_5"
android:layout_marginRight="@dimen/margin_5"
android:textAlignment="center"
android:gravity="center"
android:fontFamily="@font/sf_regular"
android:text=""
android:textColor="@color/colorOrange"
android:textSize="@dimen/text_20" />
</LinearLayout>
</RelativeLayout>
<LinearLayout
android:id="@+id/ll_clubNews"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:layout_below="@+id/card_notification">
<TextView
android:id="@+id/tv_ClubNewsTitle"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:textColor="@color/color_texts"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp"
android:singleLine="true"
android:fontFamily="@font/sf_regular"
android:layout_marginTop="@dimen/margin_5"
android:text=""
android:layout_weight="0.7"
android:textSize="@dimen/text_18" />
<TextView
android:id="@+id/tv_ClubNewsDate"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:textColor="@color/color_texts"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp"
android:fontFamily="@font/sf_regular"
android:layout_below="@+id/tv_ClubNewsTitle"
android:text=""
android:layout_weight="0.7"
android:textSize="@dimen/text_14" />
</LinearLayout>
</RelativeLayout>
<com.bocawestcc.cobaltmemberapp.custom.MyRecycler
android:id="@+id/recyclerview"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1"
android:layout_below="@+id/toolbar"
android:background="@color/colorgbGrey"/>
<View
android:layout_width="match_parent"
android:layout_height="0.2dp"
android:background="@color/colorDividerGrey" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@color/colorLightWhite"
android:orientation="vertical">
<TextView
android:id="@+id/txt_sendUsFeedback"
android:layout_width="match_parent"
android:layout_height="20dp"
android:textColor="#3D3D3D"
android:textAlignment="center"
android:layout_marginTop="8dp"
android:layout_marginBottom="@dimen/padding_8"
android:visibility="visible"
android:gravity="bottom"
android:fontFamily="@font/sf_regular"
android:layout_gravity="bottom"
android:textSize="@dimen/text_14"
android:text="Send Us feedback" />
</LinearLayout>
</LinearLayout>
</com.bocawestcc.cobaltmemberapp.util.CustomScrollView>
<LinearLayout
android:layout_width="match_parent"
android:layout_alignParentBottom="true"
android:layout_height="wrap_content"
android:layout_weight="0"
android:orientation="vertical">
<View
android:layout_width="match_parent"
android:layout_height="@dimen/footer_height"
android:background="@color/colorLightWhite" />
</LinearLayout>
<RelativeLayout
android:id="@+id/rr_sendfeedback"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_below="@+id/v_toolbar"
android:visibility="gone">
<include layout="@layout/include_sendus_feed" />
</RelativeLayout>
</RelativeLayout>
请建议我,如何解决此类设计问题。欢迎所有建议。感谢您。!
解决方案
推荐阅读
- swift - 使用 LSCopyApplicationURLsForBundleIdentifier 和 CFArrayGetValueAtIndex 获取应用程序的 URL/路径时出错
- r - 使用 purrr::map 在输出中获取多列
- javascript - 性能:findIndex 与 Array.prototype.map
- php - 在进行条带 api 收费后捕获状态
- java - 如何在 HashMap 中找到相同的键和值
- bash - 使用 Bash echo 回答 pkgadd 提示
- python-3.x - 在 Python 3 的类中实现抽象变量的正确方法是什么?
- vba - MATLAB 中 VBA 的“Like”函数
- r - 问:R for-loop 和 tibble
- rasa-core - 使用或不使用 RASA 核心意味着什么?