本文整理汇总了Java中android.widget.AutoCompleteTextView.requestFocus方法的典型用法代码示例。如果您正苦于以下问题:Java AutoCompleteTextView.requestFocus方法的具体用法?Java AutoCompleteTextView.requestFocus怎么用?Java AutoCompleteTextView.requestFocus使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类android.widget.AutoCompleteTextView
的用法示例。
在下文中一共展示了AutoCompleteTextView.requestFocus方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: setContentView
import android.widget.AutoCompleteTextView; //导入方法依赖的package包/类
public void setContentView(View contentView) {
ViewGroup.LayoutParams layoutParams = new ViewGroup.LayoutParams(
ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT);
contentView.setLayoutParams(layoutParams);
if (contentView instanceof ListView) {
setListViewHeightBasedOnChildren((ListView) contentView);
}
LinearLayout linearLayout = (LinearLayout) mAlertDialogWindow.findViewById(
R.id.message_content_view);
if (linearLayout != null) {
linearLayout.removeAllViews();
linearLayout.addView(contentView);
}
for (int i = 0; i < (linearLayout != null ? linearLayout.getChildCount() : 0); i++) {
if (linearLayout.getChildAt(i) instanceof AutoCompleteTextView) {
AutoCompleteTextView autoCompleteTextView
= (AutoCompleteTextView) linearLayout.getChildAt(i);
autoCompleteTextView.setFocusable(true);
autoCompleteTextView.requestFocus();
autoCompleteTextView.setFocusableInTouchMode(true);
}
}
}
示例2: onLayoutClick
import android.widget.AutoCompleteTextView; //导入方法依赖的package包/类
private void onLayoutClick(){
int totalChips = this.getChildCount() - 1;
if(totalChips < 0){
createNewChipLayout(null);
}else{
AutoCompleteTextView autoCompleteTextView = (AutoCompleteTextView) ((ViewGroup)this.getChildAt(totalChips)).getChildAt(labelPosition);
if(autoCompleteTextView.isFocusable()){
autoCompleteTextView.requestFocus();
InputMethodManager inputMethodManager=(InputMethodManager)context.getSystemService(Context.INPUT_METHOD_SERVICE);
inputMethodManager.toggleSoftInputFromWindow(autoCompleteTextView.getApplicationWindowToken(), InputMethodManager.SHOW_FORCED, 0);
}else{
createNewChipLayout(null);
}
}
}
示例3: onMenuItemClick
import android.widget.AutoCompleteTextView; //导入方法依赖的package包/类
@Override
public boolean onMenuItemClick(MenuItem item)
{
TextInputLayout searchLayout = (TextInputLayout) activity.findViewById(R.id.search_input_layout);
AutoCompleteTextView searchText = (AutoCompleteTextView) activity.findViewById(R.id.search_input_text);
ImageButton cancel = (ImageButton) activity.findViewById(R.id.cancel_search);
searchLayout.setVisibility(View.VISIBLE);
cancel.setVisibility(View.VISIBLE);
if ( searchText.requestFocus() )
{
showKeyboard();
}
AutoCompleteTextView searchAutoCompleteTextView = (AutoCompleteTextView) activity.findViewById(R.id.search_input_text);
searchAutoCompleteTextView.setText(StringUtils.EMPTY);
return true;
}
示例4: setContentView
import android.widget.AutoCompleteTextView; //导入方法依赖的package包/类
public void setContentView(View contentView)
{
ViewGroup.LayoutParams layoutParams = new ViewGroup.LayoutParams(
ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT);
contentView.setLayoutParams(layoutParams);
if (contentView instanceof ListView)
{
setListViewHeightBasedOnChildren((ListView) contentView);
}
LinearLayout linearLayout = (LinearLayout) mAlertDialogWindow.findViewById(
R.id.message_content_view);
if (linearLayout != null)
{
linearLayout.removeAllViews();
linearLayout.addView(contentView);
}
for (int i = 0; i < (linearLayout != null ? linearLayout.getChildCount() : 0); i++)
{
if (linearLayout.getChildAt(i) instanceof AutoCompleteTextView)
{
AutoCompleteTextView autoCompleteTextView
= (AutoCompleteTextView) linearLayout.getChildAt(i);
autoCompleteTextView.setFocusable(true);
autoCompleteTextView.requestFocus();
autoCompleteTextView.setFocusableInTouchMode(true);
}
}
}
示例5: setView
import android.widget.AutoCompleteTextView; //导入方法依赖的package包/类
public void setView(View view)
{
LinearLayout l = (LinearLayout) mAlertDialogWindow.findViewById(R.id.contentView);
l.removeAllViews();
ViewGroup.LayoutParams layoutParams = new ViewGroup.LayoutParams(
ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT);
view.setLayoutParams(layoutParams);
view.setOnFocusChangeListener(new View.OnFocusChangeListener() {
@Override public void onFocusChange(View v, boolean hasFocus)
{
mAlertDialogWindow.setSoftInputMode(
WindowManager.LayoutParams.SOFT_INPUT_STATE_ALWAYS_VISIBLE);
// show imm
InputMethodManager imm = (InputMethodManager) mContext.getSystemService(
Context.INPUT_METHOD_SERVICE);
imm.toggleSoftInput(InputMethodManager.SHOW_FORCED,
InputMethodManager.HIDE_IMPLICIT_ONLY);
}
});
l.addView(view);
if (view instanceof ViewGroup)
{
ViewGroup viewGroup = (ViewGroup) view;
for (int i = 0; i < viewGroup.getChildCount(); i++)
{
if (viewGroup.getChildAt(i) instanceof EditText)
{
EditText editText = (EditText) viewGroup.getChildAt(i);
editText.setFocusable(true);
editText.requestFocus();
editText.setFocusableInTouchMode(true);
}
}
for (int i = 0; i < viewGroup.getChildCount(); i++)
{
if (viewGroup.getChildAt(i) instanceof AutoCompleteTextView)
{
AutoCompleteTextView autoCompleteTextView = (AutoCompleteTextView) viewGroup
.getChildAt(i);
autoCompleteTextView.setFocusable(true);
autoCompleteTextView.requestFocus();
autoCompleteTextView.setFocusableInTouchMode(true);
}
}
}
}
示例6: initAutoEditText
import android.widget.AutoCompleteTextView; //导入方法依赖的package包/类
public void initAutoEditText(AutoCompleteTextView autoCompleteTextView) {
autoCompleteTextView.requestFocus();
autoCompleteTextView.setCursorVisible(true);
}
示例7: onCreateView
import android.widget.AutoCompleteTextView; //导入方法依赖的package包/类
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
View view = inflater.inflate(R.layout.fragment_technicolor, container, false);
loading = view.findViewById(R.id.loading_spinner);
mainView = view.findViewById(R.id.main_view);
final CheckBox freq24 = (CheckBox) view.findViewById(R.id.radio_24);
final CheckBox freq5 = (CheckBox) view.findViewById(R.id.radio_5);
final AutoCompleteTextView edit = (AutoCompleteTextView) view
.findViewById(R.id.manual_autotext);
final String[] routers = getResources().getStringArray(
R.array.supported_routers);
ArrayAdapter<String> adapter = new ArrayAdapter<>(getActivity(),
android.R.layout.simple_dropdown_item_1line, routers);
edit.setAdapter(adapter);
edit.setThreshold(1);
edit.requestFocus();
final InputFilter filterSSID = new InputFilter() {
public CharSequence filter(CharSequence source, int start, int end,
Spanned dest, int dstart, int dend) {
for (int i = start; i < end; i++) {
if (!Character.isLetterOrDigit(source.charAt(i))
&& source.charAt(i) != '-'
&& source.charAt(i) != '_'
&& source.charAt(i) != ' ') {
return "";
}
}
return null;
}
};
final InputFilter lengthFilter = new InputFilter.LengthFilter(8); //Filter to 10 characters
edit.setFilters(new InputFilter[]{filterSSID, lengthFilter});
edit.setImeOptions(EditorInfo.IME_ACTION_DONE);
Button calc = (Button) view.findViewById(R.id.bt_calc);
calc.setOnClickListener(new View.OnClickListener() {
@TargetApi(Build.VERSION_CODES.HONEYCOMB)
public void onClick(View v) {
String ssid = "UPC" + edit.getText().toString().trim();
if (!freq24.isChecked() && !freq5.isChecked()) {
freq24.setChecked(true);
freq5.setChecked(true);
}
int mode = (freq24.isChecked() ? 1 : 0) | (freq5.isChecked() ? 2 : 0);
KeygenMatcherTask matcher = new KeygenMatcherTask(ssid, mode);
if (Build.VERSION.SDK_INT <= Build.VERSION_CODES.GINGERBREAD_MR1) {
matcher.execute();
} else {
matcher.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
}
}
});
return view;
}
示例8: setView
import android.widget.AutoCompleteTextView; //导入方法依赖的package包/类
public void setView(View view) {
LinearLayout l = (LinearLayout) mAlertDialogWindow.findViewById(R.id.contentView);
l.removeAllViews();
ViewGroup.LayoutParams layoutParams = new ViewGroup.LayoutParams(
ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT);
view.setLayoutParams(layoutParams);
view.setOnFocusChangeListener(new View.OnFocusChangeListener() {
@Override public void onFocusChange(View v, boolean hasFocus) {
mAlertDialogWindow.setSoftInputMode(
WindowManager.LayoutParams.SOFT_INPUT_STATE_ALWAYS_VISIBLE);
// show imm
InputMethodManager imm = (InputMethodManager) mContext.getSystemService(
Context.INPUT_METHOD_SERVICE);
imm.toggleSoftInput(InputMethodManager.SHOW_FORCED,
InputMethodManager.HIDE_IMPLICIT_ONLY);
}
});
l.addView(view);
if (view instanceof ViewGroup) {
ViewGroup viewGroup = (ViewGroup) view;
for (int i = 0; i < viewGroup.getChildCount(); i++) {
if (viewGroup.getChildAt(i) instanceof EditText) {
EditText editText = (EditText) viewGroup.getChildAt(i);
editText.setFocusable(true);
editText.requestFocus();
editText.setFocusableInTouchMode(true);
}
}
for (int i = 0; i < viewGroup.getChildCount(); i++) {
if (viewGroup.getChildAt(i) instanceof AutoCompleteTextView) {
AutoCompleteTextView autoCompleteTextView = (AutoCompleteTextView) viewGroup
.getChildAt(i);
autoCompleteTextView.setFocusable(true);
autoCompleteTextView.requestFocus();
autoCompleteTextView.setFocusableInTouchMode(true);
}
}
}
}