Android 每行有2个按钮和文本的listview
我是android开发的新手。我想在列表视图的行中添加两个按钮。我添加了一个文本并将其居中,但当我添加一个图像按钮时,它运行不正常。你能帮我一下吗?这是listview行的布局,正在工作。我想添加到按钮 listviviItems.XMLAndroid 每行有2个按钮和文本的listview,android,android-layout,android-intent,android-listview,Android,Android Layout,Android Intent,Android Listview,我是android开发的新手。我想在列表视图的行中添加两个按钮。我添加了一个文本并将其居中,但当我添加一个图像按钮时,它运行不正常。你能帮我一下吗?这是listview行的布局,正在工作。我想添加到按钮 listviviItems.XML <TextView xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/listView12" android:layout_w
<TextView
xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/listView12"
android:layout_width="match_parent"
android:layout_height="40dp"
android:gravity="center_horizontal"
android:layout_gravity="center_horizontal"
android:text="hello" />
使用正确的布局。
如果希望每行中有多个视图,则需要将视图组作为根视图,并将所需视图作为其子视图
你能详细说明一下“它运行不好”吗?把你所有的布局都贴在plz上。
<ImageView
android:id="@+id/image_comment_frame"
android:layout_width="60dp"
android:layout_height="60dp"
android:layout_alignParentLeft="true"
android:layout_alignParentTop="true"
android:layout_margin="15dp"
android:layout_marginBottom="10dp"
/>
<TextView
android:id="@+id/tv_comment_username"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignTop="@id/image_comment_frame"
android:layout_toRightOf="@+id/image_comment_photo"
android:text="Name"
android:textSize="15sp" />
<TextView
android:id="@+id/tv_comment_commenttext"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@id/tv_comment_username"
android:layout_toRightOf="@+id/image_comment_photo"
android:text="comment text"
android:textSize="15sp"
android:textStyle="bold" />