更新時(shí)間:2017-07-02 來源:黑馬程序員Android+物聯(lián)網(wǎng)培訓(xùn)學(xué)院 瀏覽量:
<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+物聯(lián)網(wǎng)培訓(xùn)之Volley框架進(jìn)行網(wǎng)絡(luò)通訊
2017-07-02Android+物聯(lián)網(wǎng)培訓(xùn)實(shí)戰(zhàn)教程之使用google-gson處理json格式數(shù)據(jù)
2017-07-02Android+物聯(lián)網(wǎng)培訓(xùn)之使用Cordova框架開發(fā)Android Hybrid App
2017-07-02Android+物聯(lián)網(wǎng)培訓(xùn)之使用ActionBar搭建Android UI框架
2017-07-02Android+物聯(lián)網(wǎng)培訓(xùn)之模擬器加速器安裝
2017-07-02Android+物聯(lián)網(wǎng)培訓(xùn)之進(jìn)程和線程詳解
2017-07-02