在android布局中没有使用任何特定的尺寸,但mobile view和emulator完全不同
这是我目前正在使用的xml 在这个xml中,我几乎使用了包装内容和匹配父对象 我可以根据模拟器设置listview高度。在emulator中,它显示得非常完美,视图看起来也非常完美。但是,在这里更新的移动视图看起来与emulator不一样 这里我的模拟器和手机大小完全不同,如何根据手机大小发送?在mobile中,它在底部显示空间,但在emulator中不显示 有谁能帮我根据手机大小设置吗?如果我在大型模拟器中查看相同的代码,它看起来与大型移动视图一样。 如果我改变尺寸,小型手机的尺寸会有所不同,那么我如何克服这些问题呢?是否可以查看相同的所有移动视图 提前感谢您的建议在android布局中没有使用任何特定的尺寸,但mobile view和emulator完全不同,android,xml,android-layout,Android,Xml,Android Layout,这是我目前正在使用的xml 在这个xml中,我几乎使用了包装内容和匹配父对象 我可以根据模拟器设置listview高度。在emulator中,它显示得非常完美,视图看起来也非常完美。但是,在这里更新的移动视图看起来与emulator不一样 这里我的模拟器和手机大小完全不同,如何根据手机大小发送?在mobile中,它在底部显示空间,但在emulator中不显示 有谁能帮我根据手机大小设置吗?如果我在大型模拟器中查看相同的代码,它看起来与大型移动视图一样。 如果我改变尺寸,小型手机的尺寸会有所不同,
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent" >
<ListView
android:id="@+id/cheflist"
android:layout_width="match_parent"
android:layout_height="320dp"
android:divider="#778899"
android:dividerHeight="1sp">
</ListView>
<RelativeLayout
android:id="@+id/footer"
android:layout_below="@+id/cheflist"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_alignParentBottom="true">
<include layout="@layout/footer"/>
</RelativeLayout>
</RelativeLayout>
只需更改ListView的高度以匹配参数,即可解决您的问题。请尝试以下代码:-
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent" >
<RelativeLayout
android:id="@+id/footer"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true" >
// make sure footer layout view have width match_parent and height wrap_content
<include layout="@layout/footer"/>
</RelativeLayout>
<ListView
android:id="@+id/cheflist"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_above="@+id/footer"
android:divider="#778899"
android:dividerHeight="1sp" >
</ListView>
</RelativeLayout>
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent" >
<ListView
android:id="@+id/cheflist"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:divider="#778899"
android:dividerHeight="1sp"
android:layout_above="@+id/footer">
</ListView>
<LinearLayout
android:id="@+id/footer"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true">
<include layout="@layout/footer"/>
</LinearLayout>
</RelativeLayout>
你在期待什么?你想让整个屏幕被列表视图占据,而在底部被相对视图占据?请尝试固定底部布局的大小,并使listview的高度与Parent匹配。我希望同时显示列表视图和页脚。。但是我不想要图片中显示的任何空间。@yamuna如果listview中的项目数量少于您想要的数量???第二个相对位置您的高度需要是wrap\u content。第二个布局高度已经是wrap\u content,但仍然没有出现。我想您的问题是android:layout\u below=@+id/cheflist这行。删除它并重试。将上面的代码替换为以前的代码并通知我。第二个布局不显示任何内容。它会移到外部。请发送此布局=@layout/footer?是的,请尽快粘贴:它不支持那么多的角色