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

Android 自定義對話框 showSetPwdDialog

 更新時間:2016年03月29日 09:13:50   作者:榮雪---rongsnow  
這篇文章主要介紹了Android 自定義對話框 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="請輸入密碼"
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="請再次輸入密碼"
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);//將當前布局對象設(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 自定義對話框 showSetPwdDialog,小編就給大家介紹這么多,希望對大家有所幫助!

相關(guān)文章

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

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

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

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

    這篇文章主要介紹了Android中WebView加載的網(wǎng)頁被放大的問題的解決辦法,非常不錯,具有參考借鑒價值,需要的朋友參考下
    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)資料,文中通過代碼介紹的非常詳細,需要的朋友可以參考下
    2024-04-04
  • Android編程實現(xiàn)為應(yīng)用添加菜單的方法

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

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

    分享一個輕量級圖片加載類 ImageLoader

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

    Android.mk文件使用速通手冊

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

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

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

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

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

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

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

最新評論

平江县| 绥中县| 桐城市| 政和县| 武乡县| 舞阳县| 克东县| 甘泉县| 衡山县| 襄城县| 淮滨县| 毕节市| 鹰潭市| 平阴县| 宝兴县| 会宁县| 满洲里市| 德令哈市| 桂阳县| 儋州市| 金川县| 宁南县| 星子县| 泊头市| 上思县| 罗田县| 胶南市| 鸡泽县| 筠连县| 章丘市| 佛坪县| 塔河县| 赤壁市| 灵丘县| 颍上县| 宜宾县| 唐山市| 奉贤区| 卫辉市| 靖西县| 革吉县|