android.widget.EditText#getParent ( )源码实例Demo

下面列出了android.widget.EditText#getParent ( ) 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。

源代码1 项目: android_9.0.0_r45   文件: EditTextPreference.java
@Override
protected void onBindDialogView(View view) {
    super.onBindDialogView(view);

    EditText editText = mEditText;
    editText.setText(getText());
    
    ViewParent oldParent = editText.getParent();
    if (oldParent != view) {
        if (oldParent != null) {
            ((ViewGroup) oldParent).removeView(editText);
        }
        onAddEditTextToDialogView(view, editText);
    }
}
 
源代码2 项目: convalida   文件: EditTexts.java
private static TextInputLayout getTextInputLayout(EditText editText) {
    ViewParent parent = editText.getParent();

    while (parent instanceof View) {
        if (parent instanceof TextInputLayout) {
            return (TextInputLayout) parent;
        }
        parent = parent.getParent();
    }

    return null;
}
 
@SuppressLint("MissingSuperCall")
@Override
protected void onBindDialogView(View view) {
    EditText editText = mTextView;
    editText.setText(getText());

    ViewParent oldParent = editText.getParent();
    if (oldParent != view) {
        if (oldParent != null) {
            ((ViewGroup) oldParent).removeView(editText);
        }
        onAddEditTextToDialogView(view, editText);
    }
}
 
源代码4 项目: talk-android   文件: MaterialEditTextPreference.java
@Override
protected void onBindDialogView(@NonNull View view) {
    EditText editText = mEditText;
    editText.setText(getText());
    // Initialize cursor to end of text
    if (editText.getText().length() > 0)
        editText.setSelection(editText.length());
    ViewParent oldParent = editText.getParent();
    if (oldParent != view) {
        if (oldParent != null)
            ((ViewGroup) oldParent).removeView(editText);
        onAddEditTextToDialogView(view, editText);
    }
}
 
@SuppressLint("MissingSuperCall")
@Override
protected void onBindDialogView(@NonNull View view) {
    EditText editText = mEditText;
    editText.setText(getText());
    // Initialize cursor to end of text
    if (editText.getText().length() > 0)
        editText.setSelection(editText.length());
    ViewParent oldParent = editText.getParent();
    if (oldParent != view) {
        if (oldParent != null)
            ((ViewGroup) oldParent).removeView(editText);
        onAddEditTextToDialogView(view, editText);
    }
}
 
源代码6 项目: KUAS-AP-Material   文件: LoginActivity.java
private void findViews() {
	mIdEditText = (EditText) findViewById(R.id.editText_id);
	mIdTextInputLayout = (TextInputLayout) mIdEditText.getParent();
	mPasswordEditText = (EditText) findViewById(R.id.editText_password);
	mPasswordTextInputLayout = (TextInputLayout) mPasswordEditText.getParent();

	dot_ap = (ImageView) findViewById(R.id.dot_ap);
	dot_leave = (ImageView) findViewById(R.id.dot_leave);
	dot_bus = (ImageView) findViewById(R.id.dot_bus);

	mVersionTextView = (TextView) findViewById(R.id.textView_version);
	mRememberCheckBox = (CheckBox) findViewById(R.id.checkbox_remember);

	mLoginButton = (Button) findViewById(R.id.button_login);
}
 
@Override
protected void onAddEditTextToDialogView(@NonNull View view, @NonNull EditText editText) {
	if (editText.getParent() != null) {
		((ViewGroup) mEditText.getParent()).removeView(editText);
	}
	((ViewGroup) view).addView(
			editText,
			new LinearLayout.LayoutParams(
					ViewGroup.LayoutParams.MATCH_PARENT,
					ViewGroup.LayoutParams.WRAP_CONTENT
			)
	);
}
 
@Override
protected void onBindDialogView(View view) {
    super.onBindDialogView(view);

    EditText editText = mEditText;
    editText.setText(getText());

    ViewParent oldParent = editText.getParent();
    if (oldParent != view) {
        if (oldParent != null) {
            ((ViewGroup) oldParent).removeView(editText);
        }
        onAddEditTextToDialogView(view, editText);
    }
}
 
源代码9 项目: Atomic   文件: ConversationActivity.java
private void setupColors() {
  if( settings.tintActionbar() ) {
    // the ActionBar can be tinted. This is really cool.
    // Get the ActionBar
    ActionBar ab = getSupportActionBar();
    // Make its background drawable a ColorDrawable
    ab.setBackgroundDrawable(new ColorDrawable(_scheme.getBackground()));

    _mainToolbar.setBackgroundColor(_scheme.getBackground());

    // Create a SpannableString from the current server.
    SpannableString st = new SpannableString(server.getTitle());
    // Make its forground color (through a ForgroundColorSpan) to be the
    // foreground of the scheme.
    // This is because you can't guarantee that the ActionBar text color and
    // actionbar color aren't going to be the same.
    st.setSpan(new ForegroundColorSpan(_scheme.getForeground()),
        0, st.length(), SpannableString.SPAN_INCLUSIVE_INCLUSIVE);
    // Now, set our spannable to be the ActionBar title.
    _mainToolbar.setTitle(st);
  } else {
    (getSupportActionBar()).setTitle(server.getTitle());
  }
  EditText input = (EditText)findViewById(R.id.input);
  LinearLayout lll = (LinearLayout)(input.getParent());
  lll.setBackgroundColor(_scheme.getBackground());

  input.setTextColor(_scheme.getForeground());

}