当前位置: 首页>>代码示例>>Java>>正文


Java AutoCompleteTextView.requestFocus方法代码示例

本文整理汇总了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);
        }
    }
}
 
开发者ID:iballan,项目名称:RateDialog,代码行数:24,代码来源:MaterialDialog.java

示例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);
        }
    }

}
 
开发者ID:OfficialAmal,项目名称:ChipLayout,代码行数:17,代码来源:ChipLayout.java

示例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;
}
 
开发者ID:SecUSo,项目名称:privacy-friendly-shopping-list,代码行数:17,代码来源:ShowSearchFieldOnClickListener.java

示例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);
               }
           }
       }
 
开发者ID:stytooldex,项目名称:pius1,代码行数:29,代码来源:MaterialDialog.java

示例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);
                   }
               }
           }
       }
 
开发者ID:stytooldex,项目名称:pius1,代码行数:52,代码来源:MaterialDialog.java

示例6: initAutoEditText

import android.widget.AutoCompleteTextView; //导入方法依赖的package包/类
public void initAutoEditText(AutoCompleteTextView autoCompleteTextView) {
    autoCompleteTextView.requestFocus();
    autoCompleteTextView.setCursorVisible(true);
}
 
开发者ID:jonashao,项目名称:Samantha,代码行数:5,代码来源:EditTemplatePatternFragment.java

示例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;
}
 
开发者ID:yolosec,项目名称:upcKeygen,代码行数:64,代码来源:TechnicolorFragment.java

示例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);
            }
        }
    }
}
 
开发者ID:iballan,项目名称:RateDialog,代码行数:45,代码来源:MaterialDialog.java


注:本文中的android.widget.AutoCompleteTextView.requestFocus方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。