请问我的代码在测试时为什么总显示不出滚动的最后一项即设置?
来源:4-2 我的实现_滚动列表
李小明同学
2018-07-30 22:49:20
<?xml version="1.0" encoding="utf-8"?> <LinearLayout 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:orientation="vertical"> <RelativeLayout android:id="@+id/layout_me_header" android:layout_width="match_parent" android:layout_height="wrap_content" android:background="#008CC9" tools:ignore="UselessParent"> <Button android:id="@+id/btn_login" android:layout_width="100dp" android:layout_height="100dp" android:layout_centerHorizontal="true" android:background="@mipmap/login_btn" android:layout_marginTop="10dp"/> <LinearLayout android:layout_width="match_parent" android:layout_height="wrap_content" android:orientation="horizontal" android:layout_below="@+id/btn_login" tools:ignore="DisableBaselineAlignment" android:layout_marginBottom="10dp" android:layout_marginTop="5dp"> <LinearLayout android:layout_width="0dp" android:layout_height="wrap_content" android:orientation="vertical" android:layout_weight="1" android:gravity="center" tools:ignore="UseCompoundDrawables"> <ImageView android:layout_width="24dp" android:layout_height="24dp" android:src="@mipmap/me_menu_sail" tools:ignore="ContentDescription" /> <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="@string/me_header_sail" /> </LinearLayout> <LinearLayout android:layout_width="0dp" android:layout_height="wrap_content" android:orientation="vertical" android:layout_weight="1" android:gravity="center" tools:ignore="UseCompoundDrawables"> <ImageView android:layout_width="24dp" android:layout_height="24dp" android:src="@mipmap/me_menu_yh" tools:ignore="ContentDescription" /> <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="@string/me_header_count" /> </LinearLayout> <LinearLayout android:layout_width="0dp" android:layout_height="wrap_content" android:orientation="vertical" android:layout_weight="1" android:gravity="center" tools:ignore="UseCompoundDrawables"> <ImageView android:layout_width="24dp" android:layout_height="24dp" android:src="@mipmap/me_menu_go" tools:ignore="ContentDescription" /> <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="@string/me_header_go" /> </LinearLayout> </LinearLayout> </RelativeLayout> <ScrollView android:layout_width="match_parent" android:layout_height="wrap_content"> <LinearLayout android:layout_width="match_parent" android:layout_height="wrap_content" android:orientation="vertical"> <LinearLayout android:layout_width="match_parent" android:layout_height="wrap_content" android:orientation="horizontal" android:gravity="center_vertical"> <ImageView android:layout_width="48dp" android:layout_height="48dp" android:src="@mipmap/list_my_menu" tools:ignore="ContentDescription" /> <RelativeLayout android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_marginLeft="10dp" android:layout_marginStart="10dp"> <TextView android:id="@+id/my_menu" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="@string/my_header_list_menu" android:textSize="28sp" android:paddingTop="18dp"/> <View android:layout_width="match_parent" android:layout_height="2dp" android:background="#D8DDE1" android:layout_below="@+id/my_menu" android:layout_marginTop="10dp" android:layout_marginRight="10dp" android:layout_marginEnd="10dp"> </View> </RelativeLayout> </LinearLayout> <LinearLayout android:layout_width="match_parent" android:layout_height="wrap_content" android:orientation="horizontal" android:gravity="center_vertical"> <ImageView android:layout_width="48dp" android:layout_height="48dp" android:src="@mipmap/list_save" tools:ignore="ContentDescription" /> <RelativeLayout android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_marginLeft="10dp" android:layout_marginStart="10dp"> <TextView android:id="@+id/my_save" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="@string/my_save" android:textSize="28sp" android:paddingTop="18dp"/> <View android:layout_width="match_parent" android:layout_height="2dp" android:background="#D8DDE1" android:layout_below="@+id/my_save" android:layout_marginTop="10dp" android:layout_marginRight="10dp" android:layout_marginEnd="10dp"> </View> </RelativeLayout> </LinearLayout> <LinearLayout android:layout_width="match_parent" android:layout_height="wrap_content" android:orientation="horizontal" android:gravity="center_vertical"> <ImageView android:layout_width="48dp" android:layout_height="48dp" android:src="@mipmap/list_pwd" tools:ignore="ContentDescription" /> <RelativeLayout android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_marginLeft="10dp" android:layout_marginStart="10dp"> <TextView android:id="@+id/my_pwd" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="@string/my_pwd" android:textSize="28sp" android:paddingTop="18dp"/> <View android:layout_width="match_parent" android:layout_height="2dp" android:background="#D8DDE1" android:layout_below="@+id/my_pwd" android:layout_marginTop="10dp" android:layout_marginRight="10dp" android:layout_marginEnd="10dp"> </View> </RelativeLayout> </LinearLayout> <LinearLayout android:layout_width="match_parent" android:layout_height="wrap_content" android:orientation="horizontal" android:gravity="center_vertical"> <ImageView android:layout_width="48dp" android:layout_height="48dp" android:src="@mipmap/list_my" tools:ignore="ContentDescription" /> <RelativeLayout android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_marginLeft="10dp" android:layout_marginStart="10dp"> <TextView android:id="@+id/my_my" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="@string/my_my" android:textSize="28sp" android:paddingTop="18dp"/> </RelativeLayout> </LinearLayout> <View android:layout_width="match_parent" android:layout_height="8dp" android:background="#D8DDE1" android:layout_marginTop="10dp"> </View> <LinearLayout android:layout_width="match_parent" android:layout_height="wrap_content" android:orientation="horizontal" android:gravity="center_vertical"> <ImageView android:layout_width="48dp" android:layout_height="48dp" android:src="@mipmap/list_safe_center" tools:ignore="ContentDescription" /> <RelativeLayout android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_marginLeft="10dp" android:layout_marginStart="10dp"> <TextView android:id="@+id/my_safe" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="@string/my_safe" android:textSize="28sp" android:paddingTop="18dp"/> <View android:layout_width="match_parent" android:layout_height="2dp" android:background="#D8DDE1" android:layout_below="@+id/my_safe" android:layout_marginTop="10dp" android:layout_marginRight="10dp" android:layout_marginEnd="10dp"> </View> </RelativeLayout> </LinearLayout> <LinearLayout android:layout_width="match_parent" android:layout_height="wrap_content" android:orientation="horizontal" android:gravity="center_vertical"> <ImageView android:layout_width="48dp" android:layout_height="48dp" android:src="@mipmap/list_address" tools:ignore="ContentDescription" /> <RelativeLayout android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_marginLeft="10dp" android:layout_marginStart="10dp"> <TextView android:id="@+id/my_address" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="@string/my_address" android:textSize="28sp" android:paddingTop="18dp"/> <View android:layout_width="match_parent" android:layout_height="2dp" android:background="#D8DDE1" android:layout_below="@+id/my_address" android:layout_marginTop="10dp" android:layout_marginRight="10dp" android:layout_marginEnd="10dp"> </View> </RelativeLayout> </LinearLayout> <LinearLayout android:layout_width="match_parent" android:layout_height="wrap_content" android:orientation="horizontal" android:gravity="center_vertical"> <ImageView android:layout_width="48dp" android:layout_height="48dp" android:src="@mipmap/list_service" tools:ignore="ContentDescription" /> <RelativeLayout android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_marginLeft="10dp" android:layout_marginStart="10dp"> <TextView android:id="@+id/my_service" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="@string/my_service" android:textSize="28sp" android:paddingTop="18dp"/> <View android:layout_width="match_parent" android:layout_height="2dp" android:background="#D8DDE1" android:layout_below="@+id/my_service" android:layout_marginTop="10dp" android:layout_marginRight="10dp" android:layout_marginEnd="10dp"> </View> </RelativeLayout> </LinearLayout> <LinearLayout android:layout_width="match_parent" android:layout_height="wrap_content" android:orientation="horizontal" android:gravity="center_vertical"> <ImageView android:layout_width="48dp" android:layout_height="48dp" android:src="@mipmap/list_sug" tools:ignore="ContentDescription" /> <RelativeLayout android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_marginLeft="10dp" android:layout_marginStart="10dp"> <TextView android:id="@+id/my_sug" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="@string/my_sug" android:textSize="28sp" android:paddingTop="18dp"/> </RelativeLayout> </LinearLayout> <View android:layout_width="match_parent" android:layout_height="8dp" android:background="#D8DDE1" android:layout_marginTop="10dp"> </View> <LinearLayout android:layout_width="match_parent" android:layout_height="wrap_content" android:orientation="horizontal" android:gravity="center_vertical"> <ImageView android:layout_width="48dp" android:layout_height="48dp" android:src="@mipmap/list_setting" tools:ignore="ContentDescription" /> <RelativeLayout android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_marginLeft="10dp" android:layout_marginStart="10dp"> <TextView android:id="@+id/my_setting" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="@string/my_setting" android:textSize="28sp" android:paddingTop="18dp"/> <View android:layout_width="match_parent" android:layout_height="2dp" android:background="#D8DDE1" android:layout_below="@+id/my_setting" android:layout_marginTop="10dp" android:layout_marginRight="10dp" android:layout_marginEnd="10dp"> </View> </RelativeLayout> </LinearLayout> </LinearLayout> </ScrollView> </LinearLayout>
1回答
单就你贴出来的xml布局是可以滚动到最底部my_setting项的,你滚动不到,是不是被底部导航菜单遮挡了,如果是被遮挡情况,你可以给当前xml在主布局中添加一个id,让底部菜单below它
相似问题