自定义Dialog上面的黑框或者说是Title怎么去掉
2个回答
展开全部
public static MyCustomDialog createDiaLog(Context context) {
spreferences = context.getSharedPreferences(Config.SHARE_PRE_FILE, 0);
customDialog = new MyCustomDialog(context);
View view = LayoutInflater.from(context).inflate(R.layout.dialog_user_deal, null, false);
customDialog.requestWindowFeature(Window.FEATURE_NO_TITLE);//这句话,就是决定上面的那个黑框,也就是dialog的title。
int width = spreferences.getInt("screenWidth", 480);
int height = spreferences.getInt("screenHeight", 800);
Window window = customDialog.getWindow();//这部分是设置dialog宽高的,宽高是我从sharedpreferences里面获取到的。之前程序启动的时候有获取
window.getDecorView().setPadding(0, 0, 0, 0);
WindowManager.LayoutParams lp = window.getAttributes();
lp.width = width / 4 * 3;
lp.height = height / 3 * 2;
window.setAttributes(lp);
customDialog.setContentView(view);
customDialog.getWindow().getAttributes().gravity = Gravity.CENTER;
return customDialog;
}
2016-08-09 · 知道合伙人软件行家
关注
展开全部
<?xml version="1.0" encoding="UTF-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:background="#FFFFFF"
android:id="@+id/progress_area">
<TextView android:id="@+id/progress_lab"
android:layout_gravity="center_vertical" android:layout_width="250dip"
android:layout_height="30dip" android:textColor="#000000"
android:layout_marginTop="20dip" android:text="Progress "
android:gravity="left" android:typeface="serif" />
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="horizontal" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:background="#FFFFFF"
android:id="@+id/progress_area">
<ProgressBar android:id="@+id/progress_horizontal"
style="?android:attr/progressBarStyleHorizontal" mce_style="?android:attr/progressBarStyleHorizontal"
android:layout_width="250dip" android:layout_height="15dip"
android:max="100" android:progress="0" android:secondaryProgress="0" />
<ImageView android:id="@+id/success_picture_view"
android:layout_width="fill_parent" android:layout_height="wrap_content"
android:src="@drawable/gou" android:visibility="gone">
</ImageView>
</LinearLayout>
<TextView android:id="@+id/text" android:gravity="center"
android:layout_width="250dip" android:layout_height="30dip"
android:textColor="#009900" android:layout_marginTop="5dip"
android:textSize="12sp" android:typeface="serif" android:text="Save success!"
android:textStyle="bold" />
</LinearLayout>
private Dialog buildDialog(Context context) {
Builder dialogBuilder = new AlertDialog.Builder(context);
LayoutInflater layoutInflater = (LayoutInflater) getSystemService(Context.LAYOUT_INFLATER_SERVICE);
View view = layoutInflater.inflate(R.layout.progress_view, null);
progressHorizontal = (ProgressBar) view
.findViewById(R.id.progress_horizontal);
ImageView imageView = (ImageView)view
.findViewById(R.id.success_picture_view);
dialogBuilder.setIcon(Color.parseColor("#FFFFFF"));
/*dialogBuilder.setView(view);*/
dialog = dialogBuilder.create();
dialog.setIcon(Color.parseColor("#FFFFFF"));
dialog.setView(view, 0, 0, 0, 0);
return dialog;
}
之前是dialogBuilder.setView(view);后把这句去了,修改为dialog.setView(view, 0, 0, 0, 0); 具体见上面代码,现在对dialog的布局想怎么改就怎么改了
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询