我当前的警报对话框看起来像右边的那个,我希望它看起来像左边的那个。
我想我可以通过更改自定义对话框的主题来做到这一点,但我不确定这是否正确,如果是这样,那么如何进行?无论如何我可以自定义更改正/负按钮吗?
我不想创建我的自定义对话框,因为按钮在警报对话框中显示的方式对我来说是完美的。
类似于http://developer.android.com/guide/topics/ui/dialogs.html中右侧的内容
这是我到目前为止所做的,
AlertDialog.Builder builder = new AlertDialog.Builder(LoginSignupActivity.this);
LayoutInflater inflater = getLayoutInflater();
builder.setView(inflater.inflate(R.layout.newusersignup, null)).setTitle("Sign up");
builder.setPositiveButton("OK", new DialogInterface.OnClickListener() {}
//etc
我的xml看起来像
<TextView
android:id="@+id/newUsersTxtName"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_alignParentTop="true"
android:text="Enter your name"
android:textColor="@color/white"
android:textAppearance="?android:attr/textAppearanceSmall" />
<TextView
android:id="@+id/newUserTxtPassword"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_below="@+id/newUsersName"
android:text="Enter password"
android:textColor="@color/white" />
<EditText
android:id="@+id/newUsersName"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_below="@+id/newUsersTxtName"
android:ems="10"
android:textColor="@color/white"
android:inputType="text" >
<requestFocus />
</EditText>
<EditText
android:id="@+id/newUserPassword"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_below="@+id/newUserTxtPassword"
android:ems="10"
android:textColor="@color/white"
android:inputType="textPassword" />
<EditText
android:id="@+id/newUserEmail"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_below="@+id/newUserTxtEmail"
android:ems="10"
android:textColor="@color/white"
android:inputType="textEmailAddress" />
<TextView
android:id="@+id/newUserTxtEmail"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_below="@+id/newUserPassword"
android:text="Enter your email"
android:textColor="@color/white"
android:textAppearance="?android:attr/textAppearanceSmall" />