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

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

源代码1 项目: Android-skin-support   文件: LastFragment.java
@Nullable
@Override
public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
    View view = inflater.inflate(R.layout.fragment, null);
    mEdit = (EditText) view.findViewById(R.id.edit);
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR1) {
        mEdit.setCompoundDrawablesRelativeWithIntrinsicBounds(R.drawable.drawable_left_selector,
                R.drawable.drawable_top_selector,
                R.drawable.drawable_right_selector,
                R.drawable.drawable_bottom_selector);
    }
    mEdit1 = (EditText) view.findViewById(R.id.edit1);
    mEdit1.setCompoundDrawablesWithIntrinsicBounds(R.drawable.drawable_left_selector,
            R.drawable.drawable_top_selector,
            R.drawable.drawable_right_selector,
            R.drawable.drawable_bottom_selector);
    mText1 = (TextView) view.findViewById(R.id.text1);
    mText1.setCompoundDrawablesWithIntrinsicBounds(getResources().getDrawable(R.drawable.drawable_left_selector),
            getResources().getDrawable(R.drawable.drawable_top_selector),
            getResources().getDrawable(R.drawable.drawable_right_selector),
            getResources().getDrawable(R.drawable.drawable_bottom_selector));
    return view;
}
 
源代码2 项目: Android-skin-support   文件: LastFragment.java
@Nullable
@Override
public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
    View view = inflater.inflate(R.layout.fragment, null);
    mEdit = (EditText) view.findViewById(R.id.edit);
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR1) {
        mEdit.setCompoundDrawablesRelativeWithIntrinsicBounds(R.drawable.drawable_left_selector,
                R.drawable.drawable_top_selector,
                R.drawable.drawable_right_selector,
                R.drawable.drawable_bottom_selector);
    }
    mEdit1 = (EditText) view.findViewById(R.id.edit1);
    mEdit1.setCompoundDrawablesWithIntrinsicBounds(R.drawable.drawable_left_selector,
            R.drawable.drawable_top_selector,
            R.drawable.drawable_right_selector,
            R.drawable.drawable_bottom_selector);
    mText1 = (TextView) view.findViewById(R.id.text1);
    mText1.setCompoundDrawablesWithIntrinsicBounds(getResources().getDrawable(R.drawable.drawable_left_selector),
            getResources().getDrawable(R.drawable.drawable_top_selector),
            getResources().getDrawable(R.drawable.drawable_right_selector),
            getResources().getDrawable(R.drawable.drawable_bottom_selector));
    return view;
}
 
源代码3 项目: FormatEditText   文件: MainActivity.java
private void checkSimpleValid(EditText editText) {
    if (editText.length() == 0) {
        editText.setCompoundDrawablesWithIntrinsicBounds(null, null, null, null);
    } else if (editText.length() == 13) {
        editText.setCompoundDrawablesWithIntrinsicBounds(
                null,
                null,
                ContextCompat.getDrawable(MainActivity.this, R.drawable.icon_valid),
                null);
    } else {
        editText.setCompoundDrawablesWithIntrinsicBounds(
                null,
                null,
                ContextCompat.getDrawable(MainActivity.this, R.drawable.icon_invalid),
                null);
    }
}
 
源代码4 项目: Equate   文件: ConvKeysFragment.java
private void createCustomUnitDialog() {
	AlertDialog.Builder builder = new AlertDialog.
			  Builder(getActivity());
	builder.setTitle("Create New Unit:");

	Context context = getActivity();
	final EditText filterEditText = new EditText(context);
	final TextView textView = new TextView(context);

	filterEditText.setCompoundDrawablesWithIntrinsicBounds(R.drawable.ic_search_white, 0, 0, 0);
	filterEditText.setInputType(InputType.TYPE_CLASS_TEXT);
	filterEditText.setHint("ie Dollars");

	textView.setText("Unit Name:");

	LinearLayout layout = new LinearLayout(context);
	layout.setOrientation(LinearLayout.VERTICAL);
	layout.addView(textView);
	layout.addView(filterEditText);
	builder.setView(layout);

	builder.setNegativeButton(android.R.string.cancel, null);
	AlertDialog alert = builder.create();
	alert.show();
}
 
源代码5 项目: FairySearchView   文件: FairySearchView.java
private void showOrHideSearchIcon(EditText view,boolean isShow,int imageRes){
    if(isShow){
        view.setCompoundDrawablesWithIntrinsicBounds(imageRes,0,0,0);
        view.setPadding(0,0,0,0);//清除内边距
    }else{
        view.setCompoundDrawablesWithIntrinsicBounds(0,0,0,0);
        view.setPadding(searchPaddingLeft,0,0,0);//设置左侧内边距
    }
}
 
源代码6 项目: SmartChart   文件: CommonUtils.java
public static void clearFocus(EditText editText) {
    editText.setCompoundDrawablesWithIntrinsicBounds(null, null, null, null);
}