`
liangoogle
  • 浏览: 274510 次
  • 性别: Icon_minigender_1
  • 来自: 北京
社区版块
存档分类
最新评论

自定义view

    博客分类:
  • view
阅读更多

private LayoutInflater inflater;

inflater = LayoutInflater.from(this);

 

View view = inflater.inflate(R.layout.dialog_set_password, null);

et_new_password_set = (EditText) view.findViewById(R.id.new_password_set);

et_new_password_again_set = (EditText) view.findViewById(R.id.new_password_again_set); et_new_password_again_set.setOnEditorActionListener(editorActionListener); // et_new_password_set.setKeyListener(keylistener);

// et_new_password_again_set.setKeyListener(keylistener);

et_new_password_set.addTextChangedListener(new MyTextWatcher(et_new_password_set)); et_new_password_again_set.addTextChangedListener(new MyTextWatcher(et_new_password_again_set)); et_new_password_set.setInputType(InputType.TYPE_TEXT_VARIATION_PASSWORD | InputType.TYPE_CLASS_TEXT); et_new_password_again_set .setInputType(InputType.TYPE_TEXT_VARIATION_PASSWORD | InputType.TYPE_CLASS_TEXT); cb_show_pw_set = (CheckBox) view.findViewById(R.id.cb_show_pw_set); cb_show_pw_set.setOnCheckedChangeListener(checkListener);

// TextView clearTv = (TextView) view.findViewById(R.id.clearPwd);

// clearTv.setOnClickListener(clearPwdListener);

setPWBuilder.setView(view);

 

 

dialog_set_password.xml:

 

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

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

android:id="@+id/ScrollView" android:layout_width="fill_parent"

android:layout_height="fill_parent" android:scrollbars="vertical">

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

android:layout_width="fill_parent" android:layout_height="wrap_content"

android:orientation="vertical" android:gravity="left">

 

<TextView android:layout_width="wrap_content"

android:layout_height="wrap_content" android:text="@string/input_new_password" />

<EditText android:id="@+id/new_password_set" android:inputType="textPassword"

android:layout_width="fill_parent" android:layout_height="wrap_content"

style="@style/PwdInputStyle" />

 

<TextView android:layout_width="wrap_content"

android:layout_height="wrap_content" android:text="@string/input_new_password_again" />

<EditText android:id="@+id/new_password_again_set" android:inputType="textPassword"

android:layout_width="fill_parent" android:layout_height="wrap_content"

style="@style/PwdInputStyle" />

 

<CheckBox android:id="@+id/cb_show_pw_set"

android:layout_width="wrap_content" android:layout_height="wrap_content"

android:text="@string/show_password" />

<!-- 

<TextView android:id="@+id/clearPwd" android:text="@string/clear_password_from_file"

android:textColor="#0000ff" android:textSize="16sp" android:textStyle="bold"

android:layout_width="wrap_content" android:layout_height="wrap_content" />

 -->

 

</LinearLayout>

</ScrollView>

 

 

分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics