【发布时间】:2017-06-01 05:31:05
【问题描述】:
我为listview 定制了一个adapter,但它不起作用,两个textview 在我构建时覆盖,但是当我制作xml 时它起作用了,我使用了layout_below。
字符串“nguyen quoc bao”和“13530”叠加
在xml中:
我的xml 代码:
<?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">
<TextView
android:id="@+id/textView_stud_name"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:layout_alignParentLeft="true"
android:paddingLeft="8dp"
android:textSize="18sp"
android:textStyle="bold"
android:text="111"/>
<TextView
android:id="@+id/textView_stud_id"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:layout_below="@+id/textView_stud_name"
android:paddingLeft="8dp"
android:textSize="12sp"
android:text="111"/>
<Button
android:id="@+id/btn_absence"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_centerVertical="true"
android:layout_marginRight="5dp"
android:background="@color/red"
android:text="Absence" />
<Button
android:id="@+id/btn_check"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_toLeftOf="@id/btn_absence"
android:layout_centerVertical="true"
android:layout_marginRight="5dp"
android:background="@color/green"
android:text="Check" />
</RelativeLayout>
如何解决这个问题?感谢回复。
【问题讨论】:
标签: android listview android-adapter