【发布时间】:2017-10-01 18:15:18
【问题描述】:
我正在处理列表视图..列表视图项目以垂直方式显示。但我以水平方式显示项目但不以水平方式显示项目。 并且 simple_list_item_1 不起作用..我正在向左或向右改变重力,但项目垂直显示..这是我的代码
这里是 content_main
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="horizontal" >
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="horizontal">
<EditText
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/editText"
android:layout_centerHorizontal="true" />
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Searach Now"
android:id="@+id/button"
android:layout_alignParentTop="true"
android:layout_toLeftOf="@+id/editText" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<ListView
android:id="@+id/listView1"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_below="@+id/headingText">
</ListView>
</LinearLayout>
</RelativeLayout>
这里是 simple_list_item。 XML
<TextView
android:id="@+id/text1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="left"></TextView>
<TextView
android:id="@+id/text2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="right"
></TextView>
</Relativelayout>
【问题讨论】:
标签: android listview arraylist