butterknife與bindview使用詳解
butterknife的優勢
使用方法以及注意事項:
在activity中butterknife.bind(this);必須在setcontentview();之後,且父類bind繫結後,子類不需要再bind
在fragment中butterknife.bind(this, view);
在adapter中butterknife.bind(this, view);
屬性布局不能使用private、static修飾
配置方法
dependencies 12
3456
78910
1112
繫結註解
@bindview---->繫結乙個view;id為乙個view 變數
@bindview(r.id.tv_fm1)
textview tvfm1;
@bindviews ---->繫結多個view;id為乙個view的list變數
@bindviews()
list buttons;
@bindarray---->繫結string裡面array陣列;
@bindarray(r.array.city )
string citys ;
@bindbitmap---->繫結資源為bitmap;
@bindbitmap(r.mipmap.wifi )
bitmap bitmap;
@bindbool ---->繫結boolean值
@bindcolor ---->繫結color;
@bindcolor(r.color.coloraccent)
int black;
@binddimen ---->繫結dimen;
@binddimen(r.dimen.borth_width)
int mborderwidth;
@binddrawable ----> 繫結drawable;
@binddrawable(r.drawable.test_pic)
drawable mtestpic;
@bindfloat ---->繫結float
@bindint ---->繫結int
class exampleactivity extends activity }1
2345
6789
10上面**相當於:
public void bind(exampleactivity activity)
ButterKnife與BindView使用詳解
在activity中butterknife.bind this 必須在setcontentview 之後,且父類bind繫結後,子類不需要再bind 在fragment中butterknife.bind this,view 在adapter中butterknife.bind this,view 屬性...
ButterKnife 新增使用
在使用 butterknife的時候 只配置乙個地方是不行的 之前一直只設定乙個,解析控制項有問題後來才知道,還需要把其他部分的配置補齊才能正確的解析控制項 compile com.jakewharton butterknife 8.6.0 apt com.jakewharton butterkni...
ELF與BIN檔案區別
gcc 編譯出來的是elf檔案。通常gcc o test test.c,生成的test檔案就是elf格式的,在linuxshell下輸入 test就可以執行。bin 檔案是經過壓縮的可執行檔案,去掉elf格式的東西。是直接的記憶體映像的表示。在系統沒有載入作業系統的時候可以執行。elf execut...