本文整理汇总了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);
}
示例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();
}
});
}
示例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;
}
示例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();
}
});
}
示例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);
}
}
}
});
}
示例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);
}
}
}
});
}
示例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);
}
}
}
});
}
示例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();
}
});
}
示例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);
}
}
});
}
示例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();
}
});
}
示例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();
}
});
}
示例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();
}
});
}
示例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();
}
}
});
}
示例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();
}
}
});
}
示例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();
}
}
});
}