小弟正在做一个页面,页面内的数据数量预先不可知,目前通过setAdapter动态添加,由于页面下方还有一个菜单布局,该菜单布局应该始终保持在界面最下端,但是现象是数据添加后菜单布局跑到了界面最上端,网上找了很多方法都没有效果,痛苦万分,请教各位大神该如何处理,感谢实现页面异常:布局效果:布局代码:<?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">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:id = "@+id/editLayout"
android:layout_alignParentTop="true" >
<CheckBox
android:id="@+id/iv_report_checkbox"
android:layout_width="40dp"
android:layout_height="40dp"
android:layout_alignParentLeft="true"
android:layout_centerVertical="true"
android:layout_marginLeft="12dp"
/>
<TextView
android:id="@+id/tv_report_name"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_toRightOf="@id/iv_report_checkbox"
android:clickable="true"
android:layout_centerVertical="true"
android:layout_marginRight="12dp"
android:layout_marginLeft="12dp"
android:singleLine="true"
android:text="@string/item_report_name"
android:tag = "@string/item_application_activity"
/>
</RelativeLayout> <LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:id = "@+id/menuLayout"
android:layout_alignParentBottom = "true" >
<View
android:id="@+id/placeholder"
android:layout_width="0dp"
android:layout_height="0dp"
android:layout_centerHorizontal="true"/> <Button
android:id="@+id/confirmBtn"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:background="#00ffffff"
android:text = "确定"
android:layout_alignParentLeft="true"
android:layout_alignRight="@id/placeholder"
android:layout_gravity="bottom"
android:layout_weight="1"
>
</Button>
<Button
android:id="@+id/cancelBtn"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:background="#00ffffff"
android:text = "取消"
android:layout_alignLeft="@id/placeholder"
android:layout_alignParentRight="true"
android:layout_gravity="bottom"
android:layout_weight="1"
>
</Button>
</LinearLayout>
</RelativeLayout>
<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">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:id = "@+id/editLayout"
android:layout_alignParentTop="true" >
<CheckBox
android:id="@+id/iv_report_checkbox"
android:layout_width="40dp"
android:layout_height="40dp"
android:layout_alignParentLeft="true"
android:layout_centerVertical="true"
android:layout_marginLeft="12dp"
/>
<TextView
android:id="@+id/tv_report_name"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_toRightOf="@id/iv_report_checkbox"
android:clickable="true"
android:layout_centerVertical="true"
android:layout_marginRight="12dp"
android:layout_marginLeft="12dp"
android:singleLine="true"
android:text="@string/item_report_name"
android:tag = "@string/item_application_activity"
/>
</RelativeLayout> <LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:id = "@+id/menuLayout"
android:layout_alignParentBottom = "true" >
<View
android:id="@+id/placeholder"
android:layout_width="0dp"
android:layout_height="0dp"
android:layout_centerHorizontal="true"/> <Button
android:id="@+id/confirmBtn"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:background="#00ffffff"
android:text = "确定"
android:layout_alignParentLeft="true"
android:layout_alignRight="@id/placeholder"
android:layout_gravity="bottom"
android:layout_weight="1"
>
</Button>
<Button
android:id="@+id/cancelBtn"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:background="#00ffffff"
android:text = "取消"
android:layout_alignLeft="@id/placeholder"
android:layout_alignParentRight="true"
android:layout_gravity="bottom"
android:layout_weight="1"
>
</Button>
</LinearLayout>
</RelativeLayout>
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货