国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 學院 > 開發設計 > 正文

ButterKnife最常用的用法

2019-11-09 13:47:28
字體:
來源:轉載
供稿:網友
地址:https://github.com/JakeWharton/butterknifestep1.裝ButterKnife插件step2.在.gradle文件里頂部 apply plugin: 'com.neenbedankt.android-apt'dependencies apt 'com.jakewharton:butterknife-compiler:8.0.1'step3.在布局文件前面點擊快捷鍵alt+insert==============================================================================在activity中:ButterKnife.bind(this);在fragment中:PRivate Unbinder unbinder;unbinder = ButterKnife.bind(this, view);@Overridepublic void onDestroyView() {unbinder.unbind();super.onDestroyView();}在adapter中:@Overridepublic View getView(int position, View convertView, ViewGroup parent) {ViewHolder holder;if (convertView == null) {convertView = mInflater.inflate(R.layout.person_item_layout, null);holder = new ViewHolder(convertView);convertView.setTag(holder);} else {holder = (ViewHolder) convertView.getTag();}return convertView;}class ViewHolder {@BindView(R.id.person_name)TextView name;public ViewHolder(View view) {ButterKnife.bind(this, view);}}==============================================================================@BindView(R.id.my_list_view)ListView mListView;void onButtonClick(View view) {}@OnClick({R.id.button_enable, R.id.button_disable, R.id.button_alpha_0, R.id.button_alpha_1})void editViewsClicked() {}@OnItemClick(R.id.my_list_view)void onItemClick(int position) {}@OnItemLongClick(R.id.my_list_view)boolean onItmeLongClick(int position) {retun true;}@OnCheckedChanged(R.id.simple_activity_checkbox)void onCheckedChanged(CompoundButton button, boolean checked) {}
發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表
主站蜘蛛池模板: 昌图县| 农安县| 古田县| 仙桃市| 克拉玛依市| 潼关县| 庄浪县| 苍梧县| 青龙| 茌平县| 兴安县| 定边县| 青岛市| 宁安市| 东乌| 涿州市| 乃东县| 仙游县| 乌鲁木齐县| 焦作市| 常熟市| 岳池县| 湘乡市| 孟州市| 上犹县| 连江县| 繁峙县| 武山县| 磴口县| 旬邑县| 安陆市| 淄博市| 象州县| 大安市| 越西县| 平定县| 吉木萨尔县| 明光市| 三明市| 左贡县| 蓬莱市|