最新国产好看的视频,伊人天堂AV在线,国产Aaaaaa视频,蜜臀视频在线观看一区,人妻av色图,密臀久久久精品影片,青青视频免费观看毛片,久草在线观看视,国产三级精品色情在线

Android 自定義對(duì)話框 showSetPwdDialog

 更新時(shí)間:2016年03月29日 09:13:50   作者:榮雪---rongsnow  
這篇文章主要介紹了Android 自定義對(duì)話框 showSetPwdDialog的相關(guān)資料,需要的朋友可以參考下

樣式如下所示:

布局:

layout

  dialog_set_pwd.xml

<?xml version="." encoding="utf-"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical" >
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="#EFEFEF"
android:orientation="horizontal"
android:padding="dp" >
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/dialog_title_default_icon" />
<TextView
android:id="@+id/textView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="dp"
android:text="設(shè)置密碼"
android:textColor="@color/black"
android:textSize="sp" />
</LinearLayout>
<EditText
android:id="@+id/et_pwd"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="dp"
android:hint="請(qǐng)輸入密碼"
android:inputType="textPassword" >
</EditText>
<EditText
android:id="@+id/et_pwd_confirm"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="dp"
android:hint="請(qǐng)?jiān)俅屋斎朊艽a"
android:inputType="textPassword" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:padding="dp" >
<Button
android:id="@+id/btn_ok"
android:layout_width="dp"
android:layout_height="wrap_content"
android:layout_weight=""
android:background="@drawable/btn_blue_selector"
android:text="確定"
android:layout_marginRight="dp"
android:textColor="@color/white" />
<Button
android:id="@+id/btn_cancel"
android:layout_width="dp"
android:layout_height="wrap_content"
android:layout_weight=""
android:background="@drawable/btn_white_selector"
android:text="取消"
android:textColor="@color/black" />
</LinearLayout>
</LinearLayout>

狀態(tài)選擇器:

drawable

  btn_blue_selector.xml

<?xml version="." encoding="utf-"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:drawable="@drawable/dg_btn_confirm_select" android:state_pressed="true"></item>
<item android:drawable="@drawable/dg_btn_confirm_normal"></item>
</selector>

  btn_white_selector.xml

<?xml version="." encoding="utf-"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:drawable="@drawable/dg_button_cancel_select" android:state_pressed="true"></item>
<item android:drawable="@drawable/dg_button_cancel_normal"></item>
</selector>

引用值

values

  colors.xml

<?xml version="." encoding="utf-"?>
<resources>
<color name="black">#</color>
<color name="gray">#a</color>
<color name="white">#fff</color>
<color name="red">#f</color>
<color name="shape_setting_normal">#BDEE</color>
<color name="shape_setting_pressed">#CAD</color>
<color name="blue">#FD</color>
<color name="light_green">#f</color>
</resources> 

代碼:

private void showSetPwdDialog() {
AlertDialog.Builder builder = new AlertDialog.Builder(this);
View view = View.inflate(this, R.layout.dialog_set_pwd, null);
Button btnOk = (Button) view.findViewById(R.id.btn_ok);
Button btnCancel = (Button) view.findViewById(R.id.btn_cancel);
final EditText etPwd = (EditText) view.findViewById(R.id.et_pwd);
final EditText etPwdConfirm = (EditText) view
.findViewById(R.id.et_pwd_confirm);
builder.setView(view);//將當(dāng)前布局對(duì)象設(shè)置給dialog
final AlertDialog dialog = builder.create();
btnOk.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
String pwd = etPwd.getText().toString().trim();
String pwdConfirm = etPwdConfirm.getText().toString().trim();
if (TextUtils.isEmpty(pwd) || TextUtils.isEmpty(pwdConfirm)) {
ToastUtils.showToast(getApplicationContext(), "輸入內(nèi)容不能為空!");
} else {
if (pwd.equals(pwdConfirm)) {
System.out.println("登錄成功!");
//將密碼保存在本地sp
PrefUtils.putString(getApplicationContext(),
GlobalConstants.PREF_PASSWORD,
MDUtils.getMd(pwd));
dialog.dismiss();
enterLostAndFindPage();
} else {
ToastUtils.showToast(getApplicationContext(),
"兩次密碼不一致!");
}
}
}
});
btnCancel.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
dialog.dismiss();
}
});
dialog.show();
}

有關(guān)Android 自定義對(duì)話框 showSetPwdDialog,小編就給大家介紹這么多,希望對(duì)大家有所幫助!

相關(guān)文章

  • Flutter實(shí)現(xiàn)Text完美封裝

    Flutter實(shí)現(xiàn)Text完美封裝

    本文詳細(xì)講解了Flutter實(shí)現(xiàn)Text完美封裝,文中通過示例代碼介紹的非常詳細(xì)。對(duì)大家的學(xué)習(xí)或工作具有一定的參考借鑒價(jià)值,需要的朋友可以收藏下,方便下次瀏覽觀看
    2021-11-11
  • Android中WebView加載的網(wǎng)頁被放大的解決辦法

    Android中WebView加載的網(wǎng)頁被放大的解決辦法

    這篇文章主要介紹了Android中WebView加載的網(wǎng)頁被放大的問題的解決辦法,非常不錯(cuò),具有參考借鑒價(jià)值,需要的朋友參考下
    2016-12-12
  • android圖片轉(zhuǎn)換器示例

    android圖片轉(zhuǎn)換器示例

    這篇文章主要介紹了android圖片轉(zhuǎn)換器示例,需要的朋友可以參考下
    2014-05-05
  • Android開發(fā)者常見的UI組件總結(jié)大全

    Android開發(fā)者常見的UI組件總結(jié)大全

    Android開發(fā)中UI組件是構(gòu)建用戶界面的基本元素,下面這篇文章主要給大家介紹了關(guān)于Android開發(fā)者常見的UI組件總結(jié)的相關(guān)資料,文中通過代碼介紹的非常詳細(xì),需要的朋友可以參考下
    2024-04-04
  • Android編程實(shí)現(xiàn)為應(yīng)用添加菜單的方法

    Android編程實(shí)現(xiàn)為應(yīng)用添加菜單的方法

    這篇文章主要介紹了Android編程實(shí)現(xiàn)為應(yīng)用添加菜單的方法,涉及Android菜單界面布局與功能實(shí)現(xiàn)的相關(guān)技巧,需要的朋友可以參考下
    2016-01-01
  • 分享一個(gè)輕量級(jí)圖片加載類 ImageLoader

    分享一個(gè)輕量級(jí)圖片加載類 ImageLoader

    這篇文章給大家分享一個(gè)輕量級(jí)圖片加載類 ImageLoader,需要的朋友可以參考下
    2016-08-08
  • Android.mk文件使用速通手冊(cè)

    Android.mk文件使用速通手冊(cè)

    本文將簡要介紹 Android.mk 的使用,看完本文,你將學(xué)會(huì)如何將自己的代碼通過 Android.mk 來編譯到工程中,有需要的朋友可以借鑒參考下,希望能夠有所幫助,祝大家多多進(jìn)步,早日升職加薪
    2023-08-08
  • Android中使用ViewStub實(shí)現(xiàn)布局優(yōu)化

    Android中使用ViewStub實(shí)現(xiàn)布局優(yōu)化

    ViewStub是Android布局優(yōu)化中一個(gè)很不錯(cuò)的標(biāo)簽/控件,直接繼承自View。雖然Android開發(fā)人員基本上都聽說過,但是真正用的可能不多。今天我們就來詳細(xì)探討下ViewStub的使用
    2016-09-09
  • Android中VideoView音視頻開發(fā)的實(shí)現(xiàn)

    Android中VideoView音視頻開發(fā)的實(shí)現(xiàn)

    VideoView是一個(gè)用于播放視頻的視圖組件,可以方便地在應(yīng)用程序中播放本地或網(wǎng)絡(luò)上的視頻文件,本文主要介紹了Android中VideoView音視頻開發(fā)的實(shí)現(xiàn),具有一定的 參考價(jià)值,感興趣的可以了解一下
    2025-03-03
  • activity控制對(duì)話框風(fēng)格、顯示大小與位置

    activity控制對(duì)話框風(fēng)格、顯示大小與位置

    對(duì)于對(duì)話框風(fēng)格大家普遍使用PopupWindow,也有許多朋友開發(fā)設(shè)計(jì)時(shí)使用的是activity對(duì)話框方式,因此,本文對(duì)如何通過activity實(shí)現(xiàn)與PopupWindow相同的效果進(jìn)行詳細(xì)介紹,具有很好的參考價(jià)值,需要的朋友一起來看下吧
    2016-12-12

最新評(píng)論

霍邱县| 宁城县| 宜川县| 浑源县| 循化| 河津市| 定结县| 六枝特区| 普宁市| 射洪县| 双峰县| 邵武市| 木兰县| 阜新| 东乌珠穆沁旗| 松江区| 安岳县| 米脂县| 通榆县| 南岸区| 西乌| 枝江市| 台北县| 七台河市| 阿拉尔市| 晋中市| 平遥县| 佳木斯市| 河曲县| 海伦市| 通江县| 洱源县| 突泉县| 衡阳县| 确山县| 荃湾区| 浪卡子县| 张北县| 秦皇岛市| 吴旗县| 水富县|