本文整理汇总了Java中android.widget.ImageButton.getDrawable方法的典型用法代码示例。如果您正苦于以下问题:Java ImageButton.getDrawable方法的具体用法?Java ImageButton.getDrawable怎么用?Java ImageButton.getDrawable使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类android.widget.ImageButton
的用法示例。
在下文中一共展示了ImageButton.getDrawable方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: init
import android.widget.ImageButton; //导入方法依赖的package包/类
private void init(AttributeSet attrs, int defStyle) {
// Load attributes
final TypedArray a = getContext().obtainStyledAttributes(
attrs, R.styleable.lingju, defStyle, 0);
LayoutInflater.from(getContext()).inflate(R.layout.search_online_box, this);
mLlRoot = findViewById(R.id.ll_root);
edit = (EditText) findViewById(R.id.sob_search_edit);
stateBt = (ImageButton) findViewById(R.id.sob_state_bt);
animate = AnimationUtils.loadAnimation(getContext(), R.anim.start_up_loading);
animate.setInterpolator(new LinearInterpolator());
drawable = (LevelListDrawable) stateBt.getDrawable();
edit.addTextChangedListener(searhWatcher);
edit.setOnEditorActionListener(editorActionListener);
edit.setOnClickListener(editorClickListener);
stateBt.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
if (stateBt.getVisibility() == View.VISIBLE && drawable.getLevel() == 1) {
edit.setText("");
stateBt.setVisibility(View.INVISIBLE);
}
}
});
edit.setHint(a.getString(R.styleable.lingju_hint));
// edit.setHintTextColor(getResources().getColor(R.color.navi_search_box_color));
edit.setHintTextColor(a.getColor(R.styleable.lingju_hintColor, getResources().getColor(R.color.navi_search_box_color)));
edit.setTextColor(a.getColor(R.styleable.lingju_textColor, getResources().getColor(R.color.ksw_md_solid_disable)));
mLlRoot.setBackgroundColor(a.getColor(R.styleable.lingju_search_background, getResources().getColor(R.color.green_style)));
//edit.setTextSize(a.getFloat(com.android.internal.R.styleable.TextView_textSize,12));
a.recycle();
}
示例2: onSearchViewQueryChange
import android.widget.ImageButton; //导入方法依赖的package包/类
private void onSearchViewQueryChange(final String query, final ImageButton navigateBack,
final TextView results) {
final boolean isDarkThemeSelected = ThemeUtils.isDarkThemeSelected(this);
final Drawable drawable;
if (!TextUtils.isEmpty(query)) {
if (isDarkThemeSelected) {
drawable = getDrawable(R.drawable.ic_clear_white_24dp);
} else {
drawable = getDrawable(R.drawable.ic_clear_black_24dp);
}
} else {
if (results.getVisibility() != View.INVISIBLE) {
results.setVisibility(View.INVISIBLE);
}
if (isDarkThemeSelected) {
drawable = getDrawable(R.drawable.ic_arrow_back_white_24dp);
} else {
drawable = getDrawable(R.drawable.ic_arrow_back_black_24dp);
}
}
if (navigateBack.getDrawable() != drawable) {
navigateBack.setImageDrawable(drawable);
}
if (mSearchResultsCursor != null && !mSearchResultsCursor.isEmpty()) {
resetCardViewBackground(mSearchResultsCursor.getAll(), List.class);
mSearchResultsCursor = null;
}
}