Ich versuche, ein adaptives Layout zu erstellen, das eine Textansicht, eine Listenansicht und eine Schaltfläche enthält. Folgend ist mein Code.Textview kann nicht über eine Listenansicht gesetzt werden
<?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"
android:layout_margin="10dp">
<ListView
android:id="@+id/selectedComplianceList"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentTop="true"
android:layout_marginLeft="5dp"
android:layout_marginRight="5dp"
android:layout_marginTop="10dp"
android:divider="@null"
android:dividerHeight="6dp"
android:clipToPadding="false"
android:paddingTop="10dp"
android:paddingBottom="10dp"
android:layout_above="@+id/cont" />
<LinearLayout
android:layout_width="match_parent"
android:id="@+id/cont"
android:orientation="vertical"
android:layout_marginTop="3dp"
android:layout_alignParentBottom="true"
android:layout_alignParentLeft="true"
android:layout_height="wrap_content"
android:layout_marginLeft="10dp"
android:layout_alignParentRight="true"
android:layout_alignParentEnd="true">
<Button
android:id="@+id/submit_area"
style="@style/btn"
android:layout_margin="2dp"
android:layout_marginTop="5dp"
android:layout_width="match_parent"
android:text="Submit"
android:padding="5dp"
/>
</LinearLayout>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceMedium"
android:text="ComplianceNames"
android:id="@+id/textView2"
android:layout_above="@+id/selectedComplianceList"
android:layout_centerHorizontal="true" />
</RelativeLayout>
Die Textansicht muss am Anfang der Listenansicht stehen und die Schaltfläche sollte unten sein.
- Textansicht ist oben nicht sichtbar. Wie kann ich es sichtbar machen?
- Auch wenn ich die Eigenschaft "Höhe geteilt" verwendet habe, sind die Elemente der Listenansicht nicht gleichmäßig genug. Wenn außerdem der Teiler eingestellt wird, ist die Größe des Teilers hoch. Wie kann ich es dünn machen?
Sie können eine Kopf- und Fußzeile zur Listenansicht haben – Raghunandan