更新時(shí)間:2015年12月28日15時(shí)05分 來源:傳智播客Android培訓(xùn)學(xué)院 瀏覽次數(shù):
<LinearLayout orientation="vertical">
<ImageView/>
<TextView/>
</LinearLayout>
<TextView drawableBottom="@drawable/contact"/>
<LinearLayout orientation="horizontal">
<ImageView/>
<LinearLayout orientation="vertical">
<LinearLayout orientation="horizontal">
<TextView/>
<TextView/>
</LinearLayout>
<TextView/>
<LinearLayout orientation="horizontal">
<TextView/>
<TextView/>
</LinearLayout>
</LinearLayout>
</LinearLayout>
<RelativeLayout>
<Image id=avatar layout_alignParentLeft=true />
<TextView id=name layout_alignParentTop=true layout_toRightOf=@id/avatar />
<TextView id=location layout_alignParentTop=true layout_toRightOf=@id/name />
<TextView id=desc layout_below=@id/location layout_toRightOf=@id/avatar />
....
</RelativeLayout>
<LinearLayout orientation="vertical">
......
<include layout="@layout/include_view_layout"/>
......
</LinearLayout>
而
include_view_layout.xml
的代碼如下:
<LinearLayout orientation="vertical">
<Button/>
<Button/>
</LinearLayout>
<LinearLayout orientation="vertical">
<LinearLayout orientation="vertical">
<Button/>
<Button/>
</LinearLayout>
</LinearLayout>
<merge>
<Button/>
<Button/>
</merge>
viewstub2
"
ViewStub stub1 = (ViewStub) findViewById(R.id.viewstub1);
ViewStub stub2 = (ViewStub) findViewById(R.id.viewstub2);
if(isLogin()) {
stub1.inflate();
} else {
stub2.inflate();
}
@Override
public View getView(int position, View convertView, ViewGroup parent) {
MyItem product = list.get(position);
convertView = getLayoutInflater()
.inflate(R.layout.item_record, null);
TextView tvDate = (TextView) convertView
.findViewById(R.id.tvDate);
TextView tvYongtu = (TextView) convertView
.findViewById(R.id.tvYongtu);
TextView tvMoney = (TextView) convertView
.findViewById(R.id.tvMoney);
tvDate.setText(product.detaildate);
tvYongtu.setText(product.auditmessage);
tvMoney.setText(product.detailmoney);
return convertView;
}
@Override
public View getView(int position, View convertView, ViewGroup parent) {
MyItem product = list.get(position);
ViewHolder holder;
if (convertView == null) {
convertView = getLayoutInflater().inflate(
R.layout.item_record, null);
holder = new ViewHolder();
holder.tvDate = (TextView) convertView
.findViewById(R.id.tvDate);
holder.tvYongtu = (TextView) convertView
.findViewById(R.id.tvYongtu);
holder.tvMoney = (TextView) convertView
.findViewById(R.id.tvMoney);
convertView.setTag(holder);
} else {
holder = (ViewHolder) convertView.getTag();
}
holder.tvDate.setText(product.detaildate);
holder.tvYongtu.setText(product.auditmessage);
holder.tvMoney.setText(product.detailmoney);
return convertView;
}
static class ViewHolder {
TextView tvDate;
TextView tvYongtu;
TextView tvMoney;
}
Android培訓(xùn)實(shí)戰(zhàn)教程之多次解綁拋出異常原因
2015-12-28Android培訓(xùn)實(shí)戰(zhàn)教程之WebView案例分析
2015-12-28Android培訓(xùn)實(shí)戰(zhàn)教程之java線程池總結(jié)
2015-12-28Android培訓(xùn)實(shí)戰(zhàn)教程之APK反編譯
2015-12-28Android培訓(xùn)實(shí)戰(zhàn)教程之事件傳遞
2015-12-28Android培訓(xùn)實(shí)戰(zhàn)教程之屏幕適配
2015-12-28北京校區(qū)