請參閱XML代碼多的TextView
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="wrap_content" android:layout_height="wrap_content">
<TextView android:text="@+id/TextView01" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:id="@+id/label1"
android:textSize="50px"></TextView>
<TextView android:text="TextView"
android:id="@+id/label2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"></TextView>
也看到了Java代碼
class IconicAdapter extends ArrayAdapter<String>{
IconicAdapter(){
super(NewOrderActivity.this,R.layout.rowlayout,R.id.label1,ordersId);
}// end of the constrcutor
public View getView(int position,View convertView,ViewGroup parent){
View row=super.getView(position, convertView, parent);
TextView t=(TextView)row.findViewById(R.id.label1);
TextView t1=(TextView)row.findViewById(R.id.label2);
OrdersData d=(OrdersData)dataVector.elementAt(position);
t.setText(d.order_id);
t.setText(d.orderdate);
return (row);
}
}
我要添加兩個TextView的,我可以設置文本,但應用程序崩潰時我正在檢索這些texview使用findviewById 請幫助我如何設置ListActivity行中的兩個textview