第七色在线视频,2021少妇久久久久久久久久,亚洲欧洲精品成人久久av18,亚洲国产精品特色大片观看完整版,孙宇晨将参加特朗普的晚宴

為了賬號(hào)安全,請(qǐng)及時(shí)綁定郵箱和手機(jī)立即綁定
已解決430363個(gè)問(wèn)題,去搜搜看,總會(huì)有你想問(wèn)的

AppCompatActivity 改變了我的 AlertDialog 設(shè)計(jì)

AppCompatActivity 改變了我的 AlertDialog 設(shè)計(jì)

鴻蒙傳說(shuō) 2023-10-19 21:36:46
我已將我的活動(dòng)更改為 appCompat 活動(dòng)。我還將 AlertDialog 更改為 Android.Support.V7.App.AlertDialog。但我已經(jīng)失去了以前的警報(bào)對(duì)話框設(shè)計(jì)。這就是它的樣子。這就是現(xiàn)在的樣子我到現(xiàn)在為止的主題是parent="@android:style/Theme.Holo.Light.DarkActionBar">但我被迫更改它,因?yàn)?appCompat 不支持 Holo 主題。所以我把它改為 parent="Theme.AppCompat.Light.DarkActionBar">如何使警報(bào)對(duì)話框看起來(lái)像上一個(gè)?
查看完整描述

2 回答

?
慕桂英3389331

TA貢獻(xiàn)2036條經(jīng)驗(yàn) 獲得超8個(gè)贊

嘗試這個(gè):

AlertDialog 對(duì)話框= new AlertDialog.Builder(new ContextThemeWrapper(context, android.R.style.Theme_Holo_Dialog));


查看完整回答
反對(duì) 回復(fù) 2023-10-19
?
泛舟湖上清波郎朗

TA貢獻(xiàn)1818條經(jīng)驗(yàn) 獲得超3個(gè)贊

如果你想讓按鈕可以幫助用戶更容易按下,你可以構(gòu)建一個(gè)帶有自定義按鈕的對(duì)話框并設(shè)置按鈕的樣式(例如在drawable文件夾上設(shè)置按鈕的樣式)。你可以參考以下代碼:


 AlertDialog.Builder dialog = new AlertDialog.Builder(this);

        AlertDialog alert = dialog.Create();

        alert.SetTitle("Login Information");

        //alert.SetMessage("Complex Alert");

        //alert.SetIcon(Resource.Drawable.alert);


        LayoutInflater inflater = (LayoutInflater)this.GetSystemService(Context.LayoutInflaterService);

        View view = inflater.Inflate(Resource.Layout.input_layout, null);

        alert.SetView(view);


        EditText editText_name = view.FindViewById<EditText>(Resource.Id.et_name);

        EditText editText_pwd = view.FindViewById<EditText>(Resource.Id.et_pwd);


        Button button1 = view.FindViewById<Button>(Resource.Id.button1);

        Button button2 = view.FindViewById<Button>(Resource.Id.button2);


        button1.Click += delegate {


            Toast.MakeText(this,"press button1!",ToastLength.Short).Show();

        };


        button2.Click += delegate {

            Toast.MakeText(this, "press button2!", ToastLength.Short).Show();

        };


        //alert.SetButton("OK", (c, ev) =>

        //{

        //    // Ok button click task  

        //    string name = editText_name.Text;

        //    string password = editText_pwd.Text;

        //    Toast.MakeText(this, "name = " + name + " password= " + password, ToastLength.Long).Show();

        //});

        //alert.SetButton2("CANCEL", (c, ev) => { });

        alert.Show();

這input_layout.xml


<?xml version="1.0" encoding="utf-8"?>

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"

android:orientation="vertical"  

android:layout_width="match_parent"

android:layout_height="match_parent">

<EditText 

  android:layout_width="match_parent"

  android:layout_height="wrap_content"

  android:id="@+id/et_name"

  android:hint="please input name"

/>

<EditText 

  android:layout_width="match_parent"

  android:layout_height="wrap_content"

  android:id="@+id/et_pwd"

  android:password="true"

  android:hint="please input password"

/>


<LinearLayout 

   android:padding="20dp"

    android:orientation="horizontal"

    android:layout_width="match_parent"

    android:layout_height="wrap_content"  >


    <Button 

    android:id="@+id/button1"

     android:text="button1"

     android:textColor="@android:color/white"

      android:layout_weight="1"

      android:layout_width="match_parent"

      android:layout_height="wrap_content"

      android:background="@drawable/defaultbutton"

    />

    <Button

    android:id="@+id/button2"

    android:layout_marginLeft="20dp"

    android:text="button2"

    android:textColor="@android:color/white"

    android:layout_weight="1"

    android:layout_width="match_parent"

    android:layout_height="wrap_content"

    android:background="@drawable/defaultbutton"

    />

</LinearLayout>

在文件夾中定義一個(gè)xml(例如defaultbutton.xml)drawable


<?xml version="1.0" encoding="utf-8" ?>

<shape xmlns:android="http://schemas.android.com/apk/res/android"

android:shape="rectangle">

<solid android:color="#1E90FF" />

<!--<stroke

    android:width="2dp"

    android:color="#ffffff" />-->

<corners

  android:bottomLeftRadius="20dp"

  android:bottomRightRadius="20dp"

  android:topLeftRadius="20dp"

  android:topRightRadius="20dp" />

</shape>

筆記:


1.在文件夾中定義一個(gè)xml( defaultbutton.xml)drawable


2.像這樣使用:


android:background="@drawable/defaultbutton"

結(jié)果是:

https://img1.sycdn.imooc.com/653131ab000108e203250245.jpg

查看完整回答
反對(duì) 回復(fù) 2023-10-19
  • 2 回答
  • 0 關(guān)注
  • 175 瀏覽
慕課專欄
更多

添加回答

舉報(bào)

0/150
提交
取消
微信客服

購(gòu)課補(bǔ)貼
聯(lián)系客服咨詢優(yōu)惠詳情

幫助反饋 APP下載

慕課網(wǎng)APP
您的移動(dòng)學(xué)習(xí)伙伴

公眾號(hào)

掃描二維碼
關(guān)注慕課網(wǎng)微信公眾號(hào)