您好,登錄后才能下訂單哦!
void showDialog() {
new AlertDialog.Builder(this)
.setTitle(R.string.title)
.setAdapter(new DemoAdapter(this), new onClickListener(){
@Override
public void onClick(DialogInterface dialog, int which) {
//todo
}
}).show();
}
private class DemoAdapter extends BaseAdapter{
LayoutInflater layInflater;
ShareAdapter(Context context) {
layInlater = LayoutInflater.from(context);
}
@Override
public int getCount() {
return 2;//item個數
}
@Override
public Object getItem(int position) {
return null;
}
@Override
public long getItemId(int position) {
return position;
}
@TargetApi(Build.VERSION_CODES.JELLY_BEAN_MR1)
@Override
public View getView(int position, View convertView, ViewGroup parent) {
if(convertView == null) {
convertView = layoutInflater.inflate(R.layout.layout_share_item,(注釋: layout 布局) parent, false);
}
TextView textView = (TextView)convertView.findViewById(R.id.share_title);
textView.setText(SHARE_TEXT[position]);注釋:textText設值
textView.setCompoundDrawablesRelativeWithIntrinsicBounds(SHARE_ICON[position], 0, 0, 0); 注釋:設圖片
return convertView;
}
}
免責聲明:本站發布的內容(圖片、視頻和文字)以原創、轉載和分享為主,文章觀點不代表本網站立場,如果涉及侵權請聯系站長郵箱:is@yisu.com進行舉報,并提供相關證據,一經查實,將立刻刪除涉嫌侵權內容。