问题
There is a need to displaying two views in a single ListView Row . How it is possible in android. Please help me.

回答1:
You can use custom layout for your lists , here is example which is using imageview and textview in a single row. Row.xml
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
>
<ImageView
android:id="@+id/icon"
android:padding="2dip"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/ok"
/>
<TextView
android:id="@+id/label"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textSize="40sp"
/>
</LinearLayout>
Here is java code ,this is an activity's onCreate extending ListActivity.
public void onCreate(Bundle icicle) {
super.onCreate(icicle);
setContentView(R.layout.main);
setListAdapter(new ArrayAdapter<String>(this,R.layout.row, R.id.label,items));
selection=(TextView)findViewById(R.id.selection);
}
回答2:
Use GridView
and add this to the parameters.
android:numColumns="2"
Check this first and this Kinda helped me too with the same problem. :)
来源:https://stackoverflow.com/questions/12889572/displaying-two-views-in-a-single-list-row-item-in-android