當前位置: 首頁>>代碼示例>>Java>>正文


Java AlertDialog.setContentView方法代碼示例

本文整理匯總了Java中android.app.AlertDialog.setContentView方法的典型用法代碼示例。如果您正苦於以下問題:Java AlertDialog.setContentView方法的具體用法?Java AlertDialog.setContentView怎麽用?Java AlertDialog.setContentView使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在android.app.AlertDialog的用法示例。


在下文中一共展示了AlertDialog.setContentView方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: showBottomDialog

import android.app.AlertDialog; //導入方法依賴的package包/類
public static void showBottomDialog(final Activity activity, View view) {


        final AlertDialog dialog = new AlertDialog.Builder(activity).setCancelable(true).create();
        dialog.show();
        WindowManager.LayoutParams lp = dialog.getWindow().getAttributes();
        if (lp != null) {

            lp.width = ViewGroup.LayoutParams.MATCH_PARENT;
            lp.height = ViewGroup.LayoutParams.WRAP_CONTENT;
            lp.gravity = Gravity.BOTTOM;
            dialog.getWindow().setAttributes(lp);
        }
        dialog.getWindow().setAttributes(lp);
        dialog.getWindow().setBackgroundDrawableResource(android.R.color.transparent);
        dialog.setContentView(view);


    }
 
開發者ID:zhonglikui,項目名稱:cardinalsSample,代碼行數:20,代碼來源:DialogUtil.java

示例2: ActivateReadMeDialog

import android.app.AlertDialog; //導入方法依賴的package包/類
public void ActivateReadMeDialog(Activity activity , Context context,int Language){
    AlertDialog.Builder mReadMeBuilder = new AlertDialog.Builder(activity);
    final AlertDialog mReadMeDialog =  mReadMeBuilder.create();
    mReadMeDialog.show();
    mReadMeDialog.setContentView(R.layout.read_me_layout);
    mBackButton = (Button)mReadMeDialog.findViewById(R.id.back_buttonOnReadMe);
    TextView mReadMeTextView = (TextView)mReadMeDialog.findViewById(R.id.ReadMeTextView);
    if(Language==0){mReadMeTextView.setText(activity.getResources().getString(R.string.ReadMeGrDialog));}
    else{mReadMeTextView.setText(activity.getResources().getString(R.string.ReadMeEngDialog));}
    mBackButton.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View view) {
            mReadMeDialog.cancel();
        }
    });

}
 
開發者ID:JamesNikolaidis,項目名稱:Thesis_Farmers_Helper,代碼行數:18,代碼來源:Read_Me_Dialog.java

示例3: buildBottomDialog

import android.app.AlertDialog; //導入方法依賴的package包/類
public static AlertDialog buildBottomDialog(Activity activity, View contentView) {
    AlertDialog dialog = new Builder(activity).create();
    dialog.setCanceledOnTouchOutside(true);
    dialog.show();
    dialog.setContentView(contentView);
    Window dialogWindow = dialog.getWindow();
    Display d = activity.getWindowManager().getDefaultDisplay();
    LayoutParams p = dialogWindow.getAttributes();
    p.width = d.getWidth();
    dialogWindow.setAttributes(p);
    dialogWindow.setGravity(80);
    return dialog;
}
 
開發者ID:JackChan1999,項目名稱:letv,代碼行數:14,代碼來源:DialogUtils.java

示例4: showDialogEdit

import android.app.AlertDialog; //導入方法依賴的package包/類
/**
 * 顯示輸入框
 */
public void showDialogEdit(Context context) {
    final AlertDialog dialog;
    AlertDialog.Builder builder = new AlertDialog.Builder(context, R.style.DialogTransBackGround);
    dialog = builder.create();
    dialog.setCancelable(true);
    dialog.show();
    Window window = dialog.getWindow();
    window.setWindowAnimations(R.style.AnimBottom);
    window.clearFlags(WindowManager.LayoutParams.FLAG_ALT_FOCUSABLE_IM);
    View view_dialog = LayoutInflater.from(context).inflate(R.layout.create_tip_dialog_layout, null);
    dialog.setContentView(view_dialog);
    ((TextView)view_dialog.findViewById(R.id.edt_create_layout_input)).setText("退出當前賬號?");

    TextView bt_yes = (TextView) view_dialog.findViewById(R.id.set);
    TextView bt_no = (TextView) view_dialog.findViewById(R.id.cancel);

    bt_yes.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            logout();
            dialog.dismiss();
        }
    });
    bt_no.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View view) {
            dialog.dismiss();
        }
    });
}
 
開發者ID:mangestudio,項目名稱:GCSApp,代碼行數:34,代碼來源:SettingActivity.java

示例5: showDialogFinish

import android.app.AlertDialog; //導入方法依賴的package包/類
public void showDialogFinish(final OrderDetail orderDetail){
    final AlertDialog dialog_finish;
    AlertDialog.Builder builder = new AlertDialog.Builder(context,R.style.DialogTransBackGround);
    dialog_finish = builder.create();
    dialog_finish.setCancelable(true);
    dialog_finish.show();
    View view_dialog = LayoutInflater.from(context).inflate(R.layout.item_dialog_confirm, null);
    dialog_finish.setContentView(view_dialog);
    TextView tv_title = (TextView) view_dialog.findViewById(R.id.tv_dialog_title);
    TextView tv_content = (TextView) view_dialog.findViewById(R.id.tv_dialog_content);
    Button bt_yes = (Button) view_dialog.findViewById(R.id.bt_dialog_yes);

    tv_title.setText("提示");
    tv_content.setText("確定要申請退貨嗎?");
    bt_yes.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            dialog_finish.dismiss();

            if (orderDetail.state == 4) {
                if (orderDetail.orderDetailId == 0) {
                    Toast.makeText(context, "orderDetailId為空!", Toast.LENGTH_SHORT).show();
                } else {
                    orderDetail.state = 5;
                    orderDetail.refundStatus = 1;
                    notifyDataSetChanged();
                    MyOrderActivity.instance.refundOrder(orderId, orderDetail.orderDetailId);
                }
            }
        }
    });
}
 
開發者ID:mangestudio,項目名稱:GCSApp,代碼行數:33,代碼來源:OrderInfoFinishAdapter.java

示例6: showDialogFinish

import android.app.AlertDialog; //導入方法依賴的package包/類
public void showDialogFinish(final OrderDetail orderDetail){
    final AlertDialog dialog_finish;
    AlertDialog.Builder builder = new AlertDialog.Builder(context,R.style.DialogTransBackGround);
    dialog_finish = builder.create();
    dialog_finish.setCancelable(true);
    dialog_finish.show();
    View view_dialog = LayoutInflater.from(context).inflate(R.layout.item_dialog_confirm, null);
    dialog_finish.setContentView(view_dialog);
    TextView tv_title = (TextView) view_dialog.findViewById(R.id.tv_dialog_title);
    TextView tv_content = (TextView) view_dialog.findViewById(R.id.tv_dialog_content);
    Button bt_yes = (Button) view_dialog.findViewById(R.id.bt_dialog_yes);

    tv_title.setText("提示");
    tv_content.setText("確定要申請退款嗎?");
    bt_yes.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            dialog_finish.dismiss();

            if (orderDetail.state !=5) {
                if (orderDetail.orderDetailId == 0) {
                    Toast.makeText(context, "orderDetailId為空!", Toast.LENGTH_SHORT).show();
                } else {
                    orderDetail.state = 5;
                    orderDetail.refundStatus = 1;
                    notifyDataSetChanged();
                    MyOrderActivity.instance.refundOrder(orderId, orderDetail.orderDetailId);
                }
            }
        }
    });
}
 
開發者ID:mangestudio,項目名稱:GCSApp,代碼行數:33,代碼來源:OrderInfoNotSendAdapter.java

示例7: showDialogFinish

import android.app.AlertDialog; //導入方法依賴的package包/類
public void showDialogFinish(final OrderDetail orderDetail){
    final AlertDialog dialog_finish;
    AlertDialog.Builder builder = new AlertDialog.Builder(context,R.style.DialogTransBackGround);
    dialog_finish = builder.create();
    dialog_finish.setCancelable(true);
    dialog_finish.show();
    View view_dialog = LayoutInflater.from(context).inflate(R.layout.item_dialog_confirm, null);
    dialog_finish.setContentView(view_dialog);
    TextView tv_title = (TextView) view_dialog.findViewById(R.id.tv_dialog_title);
    TextView tv_content = (TextView) view_dialog.findViewById(R.id.tv_dialog_content);
    Button bt_yes = (Button) view_dialog.findViewById(R.id.bt_dialog_yes);

    tv_title.setText("提示");
    tv_content.setText("確定要申請退款嗎?");
    bt_yes.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            dialog_finish.dismiss();

            if (orderDetail.state != 5) {
                if (orderDetail.orderDetailId == 0) {
                    Toast.makeText(context, "orderDetailId為空!", Toast.LENGTH_SHORT).show();
                } else {
                    orderDetail.state = 5;
                    orderDetail.refundStatus = 1;
                    notifyDataSetChanged();
                    MyOrderActivity.instance.refundOrder(orderId, orderDetail.orderDetailId);
                }
            }
        }
    });
}
 
開發者ID:mangestudio,項目名稱:GCSApp,代碼行數:33,代碼來源:OrderInfoSendedAdapter.java

示例8: showDialogPlace

import android.app.AlertDialog; //導入方法依賴的package包/類
void showDialogPlace() {
    final AlertDialog dialog;
    AlertDialog.Builder builder = new AlertDialog.Builder(context, R.style.DialogTransBackGround);
    dialog = builder.create();
    dialog.setCancelable(true);
    dialog.show();
    dialog.getWindow().clearFlags(WindowManager.LayoutParams.FLAG_ALT_FOCUSABLE_IM);
    View view_dialog = LayoutInflater.from(context).inflate(R.layout.item_dialog_edit, null);
    dialog.setContentView(view_dialog);

    final EditText et_content = (EditText) view_dialog.findViewById(R.id.et_content);
    Button bt_yes = (Button) view_dialog.findViewById(R.id.bt_yes);
    Button bt_no = (Button) view_dialog.findViewById(R.id.bt_no);

    et_content.setText(myInfo.permanentPlace != null ? myInfo.permanentPlace : "");
    bt_yes.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            String content = et_content.getText().toString().trim();
            if (!content.isEmpty()) {
                myInfo.permanentPlace = content;
                et_info_liveAddress.setText(content);
                dialog.dismiss();
            }
        }
    });
    bt_no.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View view) {
            dialog.dismiss();
        }
    });
}
 
開發者ID:mangestudio,項目名稱:GCSApp,代碼行數:34,代碼來源:MyInfoActivity.java

示例9: donate

import android.app.AlertDialog; //導入方法依賴的package包/類
public void donate(final int love_id, final String money) {
    final AlertDialog dialog_finish;
    AlertDialog.Builder builder = new AlertDialog.Builder(context,R.style.DialogTransBackGround);
    dialog_finish = builder.create();
    dialog_finish.setCancelable(true);
    dialog_finish.show();
    View view_dialog = LayoutInflater.from(context).inflate(R.layout.item_dialog_confirm, null);
    dialog_finish.setContentView(view_dialog);
    TextView tv_title = (TextView) view_dialog.findViewById(R.id.tv_dialog_title);
    TextView tv_content = (TextView) view_dialog.findViewById(R.id.tv_dialog_content);
    Button bt_yes = (Button) view_dialog.findViewById(R.id.bt_dialog_yes);

    tv_title.setText("提示");
    tv_content.setText("捐贈金額:" + money + "財神幣");
    bt_yes.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            MyInfo myInfo = (MyInfo) aCache.getAsObject(ACacheKey.MY_INFO);
            if (myInfo.mammonCoin < 1) {
                dialog_finish.dismiss();
                Toast.makeText(context, "財神幣不足,請先充值!", Toast.LENGTH_SHORT).show();
            } else {
                dialog_finish.dismiss();
                doDonate(love_id, money);
            }
        }
    });
}
 
開發者ID:mangestudio,項目名稱:GCSApp,代碼行數:29,代碼來源:DonateDetailActivity.java

示例10: showDialogIntroduction

import android.app.AlertDialog; //導入方法依賴的package包/類
void showDialogIntroduction() {
    final AlertDialog dialog;
    AlertDialog.Builder builder = new AlertDialog.Builder(context, R.style.DialogTransBackGround);
    dialog = builder.create();
    dialog.setCancelable(true);
    dialog.show();
    dialog.getWindow().clearFlags(WindowManager.LayoutParams.FLAG_ALT_FOCUSABLE_IM);
    View view_dialog = LayoutInflater.from(context).inflate(R.layout.item_dialog_introduction, null);
    dialog.setContentView(view_dialog);

    final EditText et_content = (EditText) view_dialog.findViewById(R.id.et_content);
    Button bt_yes = (Button) view_dialog.findViewById(R.id.bt_yes);
    Button bt_no = (Button) view_dialog.findViewById(R.id.bt_no);

    bt_yes.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            String content = et_content.getText().toString().trim();
            if (!content.isEmpty()) {
                introduction = et_content.getText().toString().trim();
                et_introduction.setText(content);
                dialog.dismiss();
            }
        }
    });
    bt_no.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View view) {
            dialog.dismiss();
        }
    });
}
 
開發者ID:mangestudio,項目名稱:GCSApp,代碼行數:33,代碼來源:InvestorsActivity.java

示例11: showDialogDatePicker

import android.app.AlertDialog; //導入方法依賴的package包/類
public void showDialogDatePicker(){
    AlertDialog.Builder builder = new AlertDialog.Builder(context, R.style.DialogTransBackGround);
    final AlertDialog dialog_date = builder.create();
    dialog_date.show();
    View view_dialog = LayoutInflater.from(context).inflate(R.layout.item_dialog_datepicker, null);
    dialog_date.setContentView(view_dialog);
    DatePicker picker = (DatePicker) view_dialog.findViewById(R.id.date_picker);
    Button bt_yes = (Button) view_dialog.findViewById(R.id.bt_yes);
    Button bt_no = (Button) view_dialog.findViewById(R.id.bt_no);

    Calendar calendar = Calendar.getInstance();
    int int_Year = calendar.get(Calendar.YEAR);
    int int_Month = calendar.get(Calendar.MONTH);
    int int_Day = calendar.get(Calendar.DAY_OF_MONTH);

    time = int_Year + "-" + String.format("%02d", (int_Month + 1)) + "-" + String.format("%02d", int_Day);
    picker.init(int_Year, int_Month, int_Day, new DatePicker.OnDateChangedListener() {
        @Override
        public void onDateChanged(DatePicker datePicker, int i, int i1, int i2) {
            Log.e("aaa", "" + i2);
            time = i + "-" + String.format("%02d", (i1 + 1)) + "-" + String.format("%02d", i2);
        }
    });
    bt_yes.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            et_add_time.setText(time);
            dialog_date.dismiss();
        }
    });
    bt_no.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View view) {
            dialog_date.dismiss();
        }
    });
}
 
開發者ID:mangestudio,項目名稱:GCSApp,代碼行數:38,代碼來源:AddCaseActivity.java

示例12: showDialogRound

import android.app.AlertDialog; //導入方法依賴的package包/類
public void showDialogRound(){
    AlertDialog.Builder builder = new AlertDialog.Builder(context, R.style.DialogTransBackGround);
    final AlertDialog dialog_date = builder.create();
    dialog_date.show();
    View view_dialog = LayoutInflater.from(context).inflate(R.layout.item_dialog_addcase_round, null);
    dialog_date.setContentView(view_dialog);
    LoopView loopView = (LoopView) view_dialog.findViewById(R.id.loopView);
    Button bt_yes = (Button) view_dialog.findViewById(R.id.bt_yes);
    Button bt_no = (Button) view_dialog.findViewById(R.id.bt_no);

    final ArrayList<String> list = new ArrayList<>();
    list.add("種子輪");
    list.add("天使輪");
    list.add("A輪");
    list.add("B輪");
    list.add("C輪");
    loopView.setTextSize(17);
    loopView.setInitPosition(0);
    loopView.setCenterTextColor(getResources().getColor(R.color.colorAppRed));
    loopView.setItemsVisibleCount(5);
    loopView.setItems(list);
    loopView.setListener(new OnItemSelectedListener() {
        @Override
        public void onItemSelected(int index) {
            et_add_rounds.setText(list.get(index));
        }
    });
    bt_yes.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            dialog_date.dismiss();
        }
    });
    bt_no.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View view) {
            dialog_date.dismiss();
        }
    });
}
 
開發者ID:mangestudio,項目名稱:GCSApp,代碼行數:41,代碼來源:AddCaseActivity.java

示例13: showDialogPrivince

import android.app.AlertDialog; //導入方法依賴的package包/類
public void showDialogPrivince(){
    final AlertDialog dialog;
    AlertDialog.Builder builder = new AlertDialog.Builder(context,R.style.DialogTransBackGround);
    dialog = builder.create();
    dialog.setCancelable(true);
    dialog.show();
    View view_dialog = LayoutInflater.from(context).inflate(R.layout.item_dialog_select_province, null);
    dialog.setContentView(view_dialog);

    TextView tv_title = (TextView) view_dialog.findViewById(R.id.tv_item_title);
    RecyclerView rv_select = (RecyclerView) view_dialog.findViewById(R.id.rv_item_select);
    tv_title.setText("選擇省份");

    GridLayoutManager layoutManager = new GridLayoutManager(context, 4);
    rv_select.setLayoutManager(layoutManager);
    Rv_SelectProvinceAdapter adapter = new Rv_SelectProvinceAdapter(context, dataProvinces);
    rv_select.setAdapter(adapter);

    adapter.setOnItemClickListener(new Rv_SelectProvinceAdapter.OnItemClickListener() {
        @Override
        public void onClick(int position) {
            if (position != 0) {
                positionProvince = position;
                tv_addAddress_province.setText(dataProvinces.get(position).name);
                province = dataProvinces.get(position).name;
                dialog.dismiss();
            }
        }
    });
}
 
開發者ID:mangestudio,項目名稱:GCSApp,代碼行數:31,代碼來源:AddAddressActivity.java

示例14: showDialogCity

import android.app.AlertDialog; //導入方法依賴的package包/類
public void showDialogCity(){
    final AlertDialog dialog;
    AlertDialog.Builder builder = new AlertDialog.Builder(context,R.style.DialogTransBackGround);
    dialog = builder.create();
    dialog.setCancelable(true);
    dialog.show();
    View view_dialog = LayoutInflater.from(context).inflate(R.layout.item_dialog_select_province, null);
    dialog.setContentView(view_dialog);

    TextView tv_title = (TextView) view_dialog.findViewById(R.id.tv_item_title);
    RecyclerView rv_select = (RecyclerView) view_dialog.findViewById(R.id.rv_item_select);
    tv_title.setText("選擇城市");

    GridLayoutManager layoutManager = new GridLayoutManager(context, 4);
    rv_select.setLayoutManager(layoutManager);
    Rv_SelectCityAdapter adapter = new Rv_SelectCityAdapter(context, dataProvinces.get(positionProvince).sub);
    rv_select.setAdapter(adapter);

    adapter.setOnItemClickListener(new Rv_SelectCityAdapter.OnItemClickListener() {
        @Override
        public void onClick(int position) {
            if (position != 0) {
                positionCity = position;
                tv_addAddress_city.setText(dataProvinces.get(positionProvince).sub.get(position).name);
                city = dataProvinces.get(positionProvince).sub.get(position).name;
                region = "";
                if (dataProvinces.get(positionProvince).sub.get(position).sub != null) {
                    showDialogRegion();
                }
                dialog.dismiss();
            }
        }
    });
}
 
開發者ID:mangestudio,項目名稱:GCSApp,代碼行數:35,代碼來源:AddAddressActivity.java

示例15: showDialogRegion

import android.app.AlertDialog; //導入方法依賴的package包/類
public void showDialogRegion(){
    final AlertDialog dialog;
    AlertDialog.Builder builder = new AlertDialog.Builder(context,R.style.DialogTransBackGround);
    dialog = builder.create();
    dialog.setCancelable(true);
    dialog.show();
    View view_dialog = LayoutInflater.from(context).inflate(R.layout.item_dialog_select_province, null);
    dialog.setContentView(view_dialog);

    TextView tv_title = (TextView) view_dialog.findViewById(R.id.tv_item_title);
    RecyclerView rv_select = (RecyclerView) view_dialog.findViewById(R.id.rv_item_select);
    tv_title.setText("選擇區域");

    GridLayoutManager layoutManager = new GridLayoutManager(context, 4);
    rv_select.setLayoutManager(layoutManager);
    Rv_SelectRegionAdapter adapter = new Rv_SelectRegionAdapter(context, dataProvinces.get(positionProvince).sub.get(positionCity).sub);
    rv_select.setAdapter(adapter);

    adapter.setOnItemClickListener(new Rv_SelectRegionAdapter.OnItemClickListener() {
        @Override
        public void onClick(int position) {
            if (position != 0) {
                positionRegion = position;
                tv_addAddress_city.setText(dataProvinces.get(positionProvince).sub.get(positionCity).name + dataProvinces.get(positionProvince).sub.get(positionCity).sub.get(position).name);
                region = dataProvinces.get(positionProvince).sub.get(positionCity).sub.get(position).name;
                dialog.dismiss();
            }
        }
    });
}
 
開發者ID:mangestudio,項目名稱:GCSApp,代碼行數:31,代碼來源:AddAddressActivity.java


注:本文中的android.app.AlertDialog.setContentView方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。