當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。