标签:
问题:自定义AlertDialog出现黑边View view = View.inflate(context, R.layout.dialog_common, null);mDialog = new AlertDialog.Builder(context).create();mDialog.setView(view);mDialog.show();
<?xml version="1.0" encoding="utf-8"?><LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="wrap_content" android:background="@drawable/shape_dialog_white" android:orientation="vertical" > <LinearLayout android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_marginBottom="35dp" android:layout_marginTop="35dp" android:gravity="center" > <TextView android:id="@+id/dialog_tv_content" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="@string/dialog_edit_wall_title" android:textColor="@android:color/black" android:textSize="19sp" /> </LinearLayout> <View android:layout_width="match_parent" android:layout_height="1dp" android:background="@color/app_color" /> <LinearLayout android:layout_width="match_parent" android:layout_height="wrap_content" android:gravity="center" > <TextView android:id="@+id/dialog_tv_left" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginBottom="12dp" android:layout_marginTop="12dp" android:layout_weight="1" android:gravity="center" android:text="@string/dialog_edit_wall_secede" android:textColor="@android:color/black" /> <TextView android:id="@+id/dialog_tv_right" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginBottom="12dp" android:layout_marginTop="12dp" android:layout_weight="1" android:gravity="center" android:text="@string/dialog_new_reply_cancel" android:textColor="@color/app_color" /> </LinearLayout></LinearLayout>
mDialog.setView(view);
mDialog.setView(view,0,0,0,0);
<!-- styles.xml on API 14+ devices --> <style name="SampleTheme.Light" parent="android:Theme.Holo.Light.DarkActionBar"> <item name="android:windowNoTitle">true</item> </style>
<activity android:name="com.kesar.ui.MainActivity" android:theme="@style/SampleTheme.Light"/>
[原创] Android 自定义AlertDialog 去黑边终极解决方案(亲测有效!)
标签:
原文地址:http://www.cnblogs.com/kesar/p/4948737.html