android,在列表项中显示箭头图标
我有一个这样声明的ListActivityandroid,在列表项中显示箭头图标,android,android-layout,Android,Android Layout,我有一个这样声明的ListActivity public class SelectSiteActivity extends ListActivity public class SiteListAdapter extends ArrayAdapter<SimpleSiteModel> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width
public class SelectSiteActivity extends ListActivity
public class SiteListAdapter extends ArrayAdapter<SimpleSiteModel>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:padding="10dp"
android:background="#ffffff">
<TextView
android:id="@+id/siteName"
android:textColor="#000000"
android:text="Site Name"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textSize="16sp" />
<ImageView
android:id="@+id/siteListMoreImage"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/expander_ic_minimized" />
</LinearLayout>
然后,我有一个这样的自定义适配器
public class SelectSiteActivity extends ListActivity
public class SiteListAdapter extends ArrayAdapter<SimpleSiteModel>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:padding="10dp"
android:background="#ffffff">
<TextView
android:id="@+id/siteName"
android:textColor="#000000"
android:text="Site Name"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textSize="16sp" />
<ImageView
android:id="@+id/siteListMoreImage"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/expander_ic_minimized" />
</LinearLayout>
公共类SiteListAdapter扩展了ArrayAdapter
我的布局是这样的
public class SelectSiteActivity extends ListActivity
public class SiteListAdapter extends ArrayAdapter<SimpleSiteModel>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:padding="10dp"
android:background="#ffffff">
<TextView
android:id="@+id/siteName"
android:textColor="#000000"
android:text="Site Name"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textSize="16sp" />
<ImageView
android:id="@+id/siteListMoreImage"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/expander_ic_minimized" />
</LinearLayout>
如何将
ImageView
一直按到右边,使它们都垂直对齐,然后TextView
占据行的其余部分,使它们都在中间垂直对齐?我不确定我是否得到了它,但如果你的意思是:
+------------+---+
| blabla | o |
+------------+---+
| bla | o |
+------------+---+
! ....... !...!
然后,您可以对
文本视图使用android:weight=1
,对图像视图使用=0
,并使用android:gravity=“center\u horizontal”
将文本居中,但其他一切都像冠军一样,它实际上应该应用于ImageView标签的安卓:layout\u gravity=“center\u vertical”
。