【发布时间】:2015-02-05 09:32:41
【问题描述】:
如何更改分隔警报按钮(正和负)的边距颜色?
这是我想要改变的:
(由于代表不能上传图片)
谢谢!
编辑
我现在拥有的是:
<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="#80000000"
>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:gravity="center|bottom"
android:layout_margin="10dp">
<ImageView
android:layout_width="100px"
android:layout_height="100px"
android:src="@drawable/more_info_icon"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:paddingBottom="10dp"
android:paddingLeft="20dp"
android:gravity="center_vertical"
android:text="More Information"
android:textColor="#000000"
android:textStyle="bold"
android:textSize="20dp"/>
</LinearLayout>
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center"
android:text="@string/alert_dialog_text_1"
android:layout_margin="@dimen/alert_margin"
android:textColor="#000000"/>
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center"
android:text="@string/alert_dialog_text_2"
android:layout_marginBottom="11dp"
android:textColor="#000000"/>
和
builder.setView(inflater.inflate(R.layout.custom_alert_dialog, null));
builder.setPositiveButton(...);
builder.setNegativeButton(...);
Button negB = ((AlertDialog) dialog).getButton(DialogInterface.BUTTON_NEGATIVE);
Button posB = ((AlertDialog) dialog).getButton(DialogInterface.BUTTON_POSITIVE);
negB.setBackgroundColor(Color.parseColor("#80000000"));
posB.setBackgroundColor(Color.parseColor("#80000000"));
【问题讨论】:
标签: android margin android-alertdialog