我正在编辑我的问题以更好地理解我需要什么,因为下面的答案没有为此提供合适的解决方案。所以,我需要做的就是制作一个带有中性按钮的自定义警报对话框。以下是它应该看起来像的示例:
请参考以下链接查看图片:https://istack.dev59.com/3dlTJ.webp 到目前为止,我已经使用了xml和将活动更改为
根据上述布局,我得到了以下结果: 我面临的问题是:如何在自定义对话框中设置中性按钮?我对此没有任何想法。如果您对我的问题有疑问,或者您无法理解语言,请留下评论,这样我就可以再次给您明确的想法。将不胜感激的帮助。
请参考以下链接查看图片:https://istack.dev59.com/3dlTJ.webp 到目前为止,我已经使用了xml和将活动更改为
android:theme="@android:style/Theme.Holo.Light.Dialog"
来使用自定义对话框,以便我可以获得相同的外观和感觉。这是我的xml代码:<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/dialog"
android:layout_width="wrap_content"
android:layout_height="wrap_content" >
<TextView
android:id="@+id/login_prompt_header"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:layout_marginTop="15dp"
android:text="@string/login_prompt_rewards_header"
android:textSize="17sp"
android:textStyle="bold" >
</TextView>
<TextView
android:id="@+id/login_prompt_text"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@+id/login_prompt_header"
android:layout_marginTop="5dp"
android:gravity="center_vertical|center_horizontal"
android:paddingLeft="18dp"
android:paddingRight="18dp"
android:text="@string/login_prompt_rewards_text"
android:textSize="15sp" >
</TextView>
<Button
android:id="@+id/log_in"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@+id/login_prompt_text"
android:layout_centerHorizontal="true"
android:layout_gravity="center_horizontal"
android:layout_marginTop="15dp"
android:background="@drawable/log_in"
android:contentDescription="@string/none" >
</Button>
<Button
android:id="@+id/create_account"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@+id/log_in"
android:layout_centerHorizontal="true"
android:layout_gravity="center_horizontal"
android:layout_marginTop="10dp"
android:background="@drawable/create_account"
android:contentDescription="@string/none" >
</Button>
</RelativeLayout>
根据上述布局,我得到了以下结果: 我面临的问题是:如何在自定义对话框中设置中性按钮?我对此没有任何想法。如果您对我的问题有疑问,或者您无法理解语言,请留下评论,这样我就可以再次给您明确的想法。将不胜感激的帮助。