本文整理汇总了Java中android.widget.AutoCompleteTextView.setHintTextColor方法的典型用法代码示例。如果您正苦于以下问题:Java AutoCompleteTextView.setHintTextColor方法的具体用法?Java AutoCompleteTextView.setHintTextColor怎么用?Java AutoCompleteTextView.setHintTextColor使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类android.widget.AutoCompleteTextView
的用法示例。
在下文中一共展示了AutoCompleteTextView.setHintTextColor方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: createAutoCompleteTextView
import android.widget.AutoCompleteTextView; //导入方法依赖的package包/类
private AutoCompleteTextView createAutoCompleteTextView(Context context) {
final LayoutParams lparamsTextView = new LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT);
lparamsTextView.setMargins(0, 0, 10, 0);
lparamsTextView.gravity = Gravity.CENTER;
final AutoCompleteTextView autoCompleteTextView = new AutoCompleteTextView(context);
autoCompleteTextView.setBackgroundColor(Color.parseColor("#00FFFFFF"));
autoCompleteTextView.setLayoutParams(lparamsTextView);
autoCompleteTextView.setHint(" ");
autoCompleteTextView.setPadding(10,0,10,10);
autoCompleteTextView.setSingleLine(true);
autoCompleteTextView.setTextColor(textColor);
autoCompleteTextView.setHintTextColor(hintColor);
autoCompleteTextView.setCursorVisible(true);
return autoCompleteTextView;
}
示例2: onPrepareOptionsMenu
import android.widget.AutoCompleteTextView; //导入方法依赖的package包/类
@Override
public void onPrepareOptionsMenu(Menu _Menu) {
// TODO: try to remove this, it seems very very hacky
// found at: http://stackoverflow.com/questions/10445760/how-to-change-the-default-icon-on-the-searchview-to-be-use-in-the-action-bar-on
if (_Menu == null) {
return;
}
MenuItem searchMenuItem = _Menu.findItem(R.id.menu_product_list_dialog_search);
SearchView searchView = (SearchView) searchMenuItem.getActionView();
searchMenuItem.setIcon(R.drawable.ic_search_white_36dp);
int searchTextViewId = android.support.v7.appcompat.R.id.search_src_text;
AutoCompleteTextView searchTextView = (AutoCompleteTextView) searchView.findViewById(searchTextViewId);
searchTextView.setHintTextColor(getResources().getColor(R.color.white));
searchTextView.setTextColor(getResources().getColor(android.R.color.white));
searchTextView.setTextSize(16.0f);
SpannableStringBuilder ssb = new SpannableStringBuilder(" "); // for the icon
//ssb.append(hintText);
Drawable searchIcon = getResources().getDrawable(R.drawable.ic_search_white_36dp);
int textSize = (int) (searchTextView.getTextSize() * 1.25);
searchIcon.setBounds(0, 0, textSize, textSize);
ssb.setSpan(new ImageSpan(searchIcon), 1, 2, Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);
searchTextView.setHint(ssb);
super.onPrepareOptionsMenu(_Menu);
}