Android Java项目-布局未正确显示(listview下的按钮)
更新:感谢所有人的帮助,布局和重量正是我想要的 我目前正在用java开发我的第一个android项目。我正在尝试使用linearlayout,它有一个覆盖页面大部分的列表视图,但在应用程序底部有一个LoadMore按钮 这就是它应该看起来的样子,也是我在Eclipse中预览到的 这就是我实际运行应用程序时发生的情况 由于某种原因,按钮被移动得比我想要的要高很多,我希望它贴在页面底部,让listview占据屏幕的其余部分 这是我的布局xmlAndroid Java项目-布局未正确显示(listview下的按钮),java,android,android-layout,Java,Android,Android Layout,更新:感谢所有人的帮助,布局和重量正是我想要的 我目前正在用java开发我的第一个android项目。我正在尝试使用linearlayout,它有一个覆盖页面大部分的列表视图,但在应用程序底部有一个LoadMore按钮 这就是它应该看起来的样子,也是我在Eclipse中预览到的 这就是我实际运行应用程序时发生的情况 由于某种原因,按钮被移动得比我想要的要高很多,我希望它贴在页面底部,让listview占据屏幕的其余部分 这是我的布局xml <?xml version="1.0" enc
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical" android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:background="#000000">
<ListView
android:id="@+id/listview"
android:layout_width="fill_parent"
android:layout_height="434dp"
android:maxHeight="434dp"
android:minHeight="434dp"
android:background="#000000" >
</ListView>
<Button
android:id="@+id/button1"
style="?android:attr/buttonStyleSmall"
android:layout_width="fill_parent"
android:layout_height="27dp"
android:maxHeight="27dp"
android:text="Load More..."
android:textSize="@dimen/dp12" />
</LinearLayout>
所以我的问题是,
我做错了什么,或者根本没有做什么,这是保持按钮在页面底部所必需的
谢谢。看起来您正在使用dp测量设置布局。尝试改用“权重”属性。它应该做你想做的,并且可以很好地扩展 祝你好运
<ListView
android:id="@+id/listview"
android:layout_width="fill_parent"
android:layout_height="0dip"
android:layout_weight="1.00"
android:background="#000000" >
</ListView>
<Button
android:id="@+id/button1"
style="?android:attr/buttonStyleSmall"
android:layout_width="fill_parent"
android:layout_height="27dp"
android:maxHeight="27dp"
android:text="Load More..."
android:textSize="@dimen/dp12" />