當前位置: 首頁>>代碼示例>>Java>>正文


Java AutoCompleteTextView.setFocusableInTouchMode方法代碼示例

本文整理匯總了Java中android.widget.AutoCompleteTextView.setFocusableInTouchMode方法的典型用法代碼示例。如果您正苦於以下問題:Java AutoCompleteTextView.setFocusableInTouchMode方法的具體用法?Java AutoCompleteTextView.setFocusableInTouchMode怎麽用?Java AutoCompleteTextView.setFocusableInTouchMode使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在android.widget.AutoCompleteTextView的用法示例。


在下文中一共展示了AutoCompleteTextView.setFocusableInTouchMode方法的6個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的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: 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

示例3: EnterJidDialog

import android.widget.AutoCompleteTextView; //導入方法依賴的package包/類
public EnterJidDialog(
	final Context context, List<String> knownHosts, final List<String> activatedAccounts,
	final String title, final String positiveButton,
	final String prefilledJid, final String account, boolean allowEditJid
) {
	AlertDialog.Builder builder = new AlertDialog.Builder(context);
	builder.setTitle(title);
	View dialogView = LayoutInflater.from(context).inflate(R.layout.enter_jid_dialog, null);
	final TextView jabberIdDesc = (TextView) dialogView.findViewById(R.id.jabber_id);
	jabberIdDesc.setText(R.string.account_settings_jabber_id);
	final Spinner spinner = (Spinner) dialogView.findViewById(R.id.account);
	final AutoCompleteTextView jid = (AutoCompleteTextView) dialogView.findViewById(R.id.jid);
	jid.setAdapter(new KnownHostsAdapter(context, R.layout.simple_list_item, knownHosts));
	if (prefilledJid != null) {
		jid.append(prefilledJid);
		if (!allowEditJid) {
			jid.setFocusable(false);
			jid.setFocusableInTouchMode(false);
			jid.setClickable(false);
			jid.setCursorVisible(false);
		}
	}

	jid.setHint(R.string.account_settings_example_jabber_id);

	if (account == null) {
		StartConversationActivity.populateAccountSpinner(context, activatedAccounts, spinner);
	} else {
		ArrayAdapter<String> adapter = new ArrayAdapter<>(context,
				R.layout.simple_list_item,
				new String[] { account });
		spinner.setEnabled(false);
		adapter.setDropDownViewResource(R.layout.simple_list_item);
		spinner.setAdapter(adapter);
	}

	builder.setView(dialogView);
	builder.setNegativeButton(R.string.cancel, null);
	builder.setPositiveButton(positiveButton, null);
	this.dialog = builder.create();

	this.dialogOnClick = new View.OnClickListener() {
		@Override
		public void onClick(final View v) {
			final Jid accountJid;
			if (!spinner.isEnabled() && account == null) {
				return;
			}
			try {
				if (Config.DOMAIN_LOCK != null) {
					accountJid = Jid.fromParts((String) spinner.getSelectedItem(), Config.DOMAIN_LOCK, null);
				} else {
					accountJid = Jid.fromString((String) spinner.getSelectedItem());
				}
			} catch (final InvalidJidException e) {
				return;
			}
			final Jid contactJid;
			try {
				contactJid = Jid.fromString(jid.getText().toString());
			} catch (final InvalidJidException e) {
				jid.setError(context.getString(R.string.invalid_jid));
				return;
			}

			if(listener != null) {
				try {
					if(listener.onEnterJidDialogPositive(accountJid, contactJid)) {
						dialog.dismiss();
					}
				} catch(JidError error) {
					jid.setError(error.toString());
				}
			}
		}
	};
}
 
開發者ID:syntafin,項目名稱:TenguChat,代碼行數:78,代碼來源:EnterJidDialog.java

示例4: 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

示例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:iballan,項目名稱:RateDialog,代碼行數:45,代碼來源:MaterialDialog.java

示例6: EnterJidDialog

import android.widget.AutoCompleteTextView; //導入方法依賴的package包/類
public EnterJidDialog(
	final Context context, List<String> knownHosts, List<String> activatedAccounts,
	final String title, final String positiveButton,
	final String prefilledJid, final String account, boolean allowEditJid
) {
	AlertDialog.Builder builder = new AlertDialog.Builder(context);
	builder.setTitle(title);
	View dialogView = LayoutInflater.from(context).inflate(R.layout.enter_jid_dialog, null);
	final Spinner spinner = (Spinner) dialogView.findViewById(R.id.account);
	final AutoCompleteTextView jid = (AutoCompleteTextView) dialogView.findViewById(R.id.jid);
	jid.setAdapter(new KnownHostsAdapter(context,android.R.layout.simple_list_item_1, knownHosts));
	if (prefilledJid != null) {
		jid.append(prefilledJid);
		if (!allowEditJid) {
			jid.setFocusable(false);
			jid.setFocusableInTouchMode(false);
			jid.setClickable(false);
			jid.setCursorVisible(false);
		}
	}

	ArrayAdapter<String> adapter;
	if (account == null) {
		adapter = new ArrayAdapter<>(context,
			android.R.layout.simple_spinner_item, activatedAccounts);
	} else {
		adapter = new ArrayAdapter<>(context,
			android.R.layout.simple_spinner_item, new String[] { account });
		spinner.setEnabled(false);
	}
	adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
	spinner.setAdapter(adapter);

	builder.setView(dialogView);
	builder.setNegativeButton(R.string.cancel, null);
	builder.setPositiveButton(positiveButton, null);
	this.dialog = builder.create();

	this.dialogOnClick = new View.OnClickListener() {
		@Override
		public void onClick(final View v) {
			final Jid accountJid;
			try {
				if (Config.DOMAIN_LOCK != null) {
					accountJid = Jid.fromParts((String) spinner.getSelectedItem(), Config.DOMAIN_LOCK, null);
				} else {
					accountJid = Jid.fromString((String) spinner.getSelectedItem());
				}
			} catch (final InvalidJidException e) {
				return;
			}
			final Jid contactJid;
			try {
				contactJid = Jid.fromString(jid.getText().toString());
			} catch (final InvalidJidException e) {
				jid.setError(context.getString(R.string.invalid_jid));
				return;
			}

			if(listener != null) {
				try {
					if(listener.onEnterJidDialogPositive(accountJid, contactJid)) {
						dialog.dismiss();
					}
				} catch(JidError error) {
					jid.setError(error.toString());
				}
			}
		}
	};
}
 
開發者ID:xavierle,項目名稱:messengerxmpp,代碼行數:72,代碼來源:EnterJidDialog.java


注:本文中的android.widget.AutoCompleteTextView.setFocusableInTouchMode方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。