如何将按钮放置在 ListView 的末尾?
我的布局屏幕有问题。我想要实现的是一个具有多行的列表视图,每行都有一个图像视图和两个 EditText
视图。在最后一行的底部,应该有两个按钮(提交和取消)
我已经设法使该行成功工作,但是在添加按钮时我不断出现错误。数据是从游标读取的,我发现这使事情变得更加复杂。
有没有办法在 contentView
布局中使用行布局?
这是 XML:
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="horizontal"
android:layout_width="wrap_content"
android:layout_height="wrap_content">
<ImageView
android:id="@+id/logo"
android:layout_width="100dp"
android:layout_height="100dp"
android:layout_alignParentTop="true"
android:layout_alignParentBottom="true"
android:src="@drawable/gm" >
</ImageView>
<EditText
android:id="@+id/firstLine"
android:layout_width="200dp"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:text="email"
>
</EditText>
<EditText
android:id="@+id/secondLine"
android:layout_width="200dp"
android:layout_height="wrap_content"
android:layout_alignRight="@id/logo"
android:layout_alignParentRight="true"
android:layout_below="@id/firstLine"
android:text="password"
>
</EditText></RelativeLayout>
I am having a problem with my layout screen. What I am trying to achieve is a listview with multiple rows, each row having one Image view and two EditText
views. At the bottom of the very last row, there should be two buttons (Submit & Cancel)
I have managed to get the row working successfully, but when adding the buttons I keep getting errors. The data is being read in from a cursor, which I find complicates things further.
Is there a way I can use a row layout inside a contentView
layout?
Here is the XML:
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="horizontal"
android:layout_width="wrap_content"
android:layout_height="wrap_content">
<ImageView
android:id="@+id/logo"
android:layout_width="100dp"
android:layout_height="100dp"
android:layout_alignParentTop="true"
android:layout_alignParentBottom="true"
android:src="@drawable/gm" >
</ImageView>
<EditText
android:id="@+id/firstLine"
android:layout_width="200dp"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:text="email"
>
</EditText>
<EditText
android:id="@+id/secondLine"
android:layout_width="200dp"
android:layout_height="wrap_content"
android:layout_alignRight="@id/logo"
android:layout_alignParentRight="true"
android:layout_below="@id/firstLine"
android:text="password"
>
</EditText></RelativeLayout>
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
使用底部按钮创建一个单独的布局,并将其添加为 页脚。顺便说一句,您还可以添加标题。
Create a separate layout with the bottom buttons and add it as a footer. You can also add a header btw.