只是無法將我的列表視圖中的文本對齊到右/左。不知道該怎麼做。 Android:引力似乎不起作用。無法在列表視圖中對齊文本
,這裏是我的xml
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="vertical"
android:background= "#FFCC00"
tools:context=".MainActivity" >
<RelativeLayout
android:layout_weight="0.5"
android:layout_width="fill_parent"
android:layout_height="0dip">
<ListView
android:id="@+id/listView1"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:divider="@null"
android:dividerHeight="0dp"
tools:listitem="@android:layout/simple_list_item_1"
android:background= "#FFCC00"
android:textColor="#330033"
android:gravity="left">
</ListView>
</RelativeLayout>
<RelativeLayout
android:layout_weight="9"
android:layout_width="fill_parent"
android:layout_height="0dip">
<TextView
android:id="@+id/bookMark"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:textStyle="bold"
android:gravity="center"
android:text="Bookmarks"
android:textColor="#330033"
android:background= "#CCCC99"
android:onClick="loadBookmarks"/>
</RelativeLayout>
這裏是填充ListView
lv = (ListView) findViewById(R.id.listView1);
lv.setAdapter(new ArrayAdapter<String>(this,R.layout.row_listview, getResources().getStringArray(R.array.Stories)));
我不明白你想做什麼 –