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


Java AutoCompleteTextView.setSelectAllOnFocus方法代码示例

本文整理汇总了Java中android.widget.AutoCompleteTextView.setSelectAllOnFocus方法的典型用法代码示例。如果您正苦于以下问题:Java AutoCompleteTextView.setSelectAllOnFocus方法的具体用法?Java AutoCompleteTextView.setSelectAllOnFocus怎么用?Java AutoCompleteTextView.setSelectAllOnFocus使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在android.widget.AutoCompleteTextView的用法示例。


在下文中一共展示了AutoCompleteTextView.setSelectAllOnFocus方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: initializeSearchSuggestions

import android.widget.AutoCompleteTextView; //导入方法依赖的package包/类
/**
 * method to generate search suggestions for the AutoCompleteTextView from
 * previously searched URLs
 */
private void initializeSearchSuggestions(final AutoCompleteTextView getUrl) {

	getUrl.setThreshold(1);
	getUrl.setDropDownWidth(-1);
	getUrl.setDropDownAnchor(R.id.toolbar_layout);
	getUrl.setOnItemClickListener(new OnItemClickListener() {

		@Override
		public void onItemClick(AdapterView<?> arg0, View arg1, int arg2, long arg3) {

		}

	});

	getUrl.setSelectAllOnFocus(true);
	mSearchAdapter = new SearchAdapter(mActivity, mDarkTheme, isIncognito());
	getUrl.setAdapter(mSearchAdapter);
}
 
开发者ID:NewCasino,项目名称:browser,代码行数:23,代码来源:BrowserActivity.java

示例2: initializeSearchSuggestions

import android.widget.AutoCompleteTextView; //导入方法依赖的package包/类
/**
 * method to generate search suggestions for the AutoCompleteTextView from
 * previously searched URLs
 */
private void initializeSearchSuggestions(final AutoCompleteTextView getUrl) {

    mSuggestionsAdapter = new SuggestionsAdapter(this, mDarkTheme, isIncognito());

    getUrl.setThreshold(1);
    getUrl.setDropDownWidth(-1);
    getUrl.setDropDownAnchor(R.id.toolbar_layout);
    getUrl.setOnItemClickListener(new OnItemClickListener() {

        @Override
        public void onItemClick(AdapterView<?> adapterView, View view, int pos, long l) {
            String url = null;
            CharSequence urlString = ((TextView) view.findViewById(R.id.url)).getText();
            if (urlString != null) {
                url = urlString.toString();
            }
            if (url == null || url.startsWith(getString(R.string.suggestion))) {
                CharSequence searchString = ((TextView) view.findViewById(R.id.title)).getText();
                if (searchString != null) {
                    url = searchString.toString();
                }
            }
            if (url == null) {
                return;
            }
            getUrl.setText(url);
            searchTheWeb(url);
            InputMethodManager imm = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE);
            imm.hideSoftInputFromWindow(getUrl.getWindowToken(), 0);
            mPresenter.onAutoCompleteItemPressed();
        }

    });

    getUrl.setSelectAllOnFocus(true);
    getUrl.setAdapter(mSuggestionsAdapter);
}
 
开发者ID:XndroidDev,项目名称:Xndroid,代码行数:42,代码来源:BrowserActivity.java

示例3: initializeSearchSuggestions

import android.widget.AutoCompleteTextView; //导入方法依赖的package包/类
/**
 * method to generate search suggestions for the AutoCompleteTextView from
 * previously searched URLs
 */
private void initializeSearchSuggestions(final AutoCompleteTextView getUrl) {

    getUrl.setThreshold(1);
    getUrl.setDropDownWidth(-1);
    getUrl.setDropDownAnchor(R.id.toolbar_layout);
    getUrl.setOnItemClickListener(new OnItemClickListener() {

        @Override
        public void onItemClick(AdapterView<?> arg0, View arg1, int arg2, long arg3) {
            try {
                String url;
                url = ((TextView) arg1.findViewById(R.id.url)).getText().toString();
                if (url.startsWith(BrowserActivity.this.getString(R.string.suggestion))) {
                    url = ((TextView) arg1.findViewById(R.id.title)).getText().toString();
                } else {
                    getUrl.setText(url);
                }
                searchTheWeb(url);
                InputMethodManager imm = (InputMethodManager) getSystemService(INPUT_METHOD_SERVICE);
                imm.hideSoftInputFromWindow(getUrl.getWindowToken(), 0);
                if (mCurrentView != null) {
                    mCurrentView.requestFocus();
                }
            } catch (NullPointerException e) {
                Log.e("Browser Error: ", "NullPointerException on item click");
            }
        }

    });

    getUrl.setSelectAllOnFocus(true);
    mSearchAdapter = new SearchAdapter(this, mDarkTheme, isIncognito());
    getUrl.setAdapter(mSearchAdapter);
}
 
开发者ID:javadtaghia,项目名称:DeeBrowser,代码行数:39,代码来源:BrowserActivity.java

示例4: initializeSearchSuggestions

import android.widget.AutoCompleteTextView; //导入方法依赖的package包/类
/**
 * method to generate search suggestions for the AutoCompleteTextView from
 * previously searched URLs
 */
private void initializeSearchSuggestions(final AutoCompleteTextView getUrl) {

    getUrl.setThreshold(1);
    getUrl.setDropDownWidth(-1);
    getUrl.setDropDownAnchor(R.id.toolbar_layout);
    getUrl.setOnItemClickListener(new OnItemClickListener() {

        @Override
        public void onItemClick(AdapterView<?> arg0, View arg1, int arg2, long arg3) {
            try {
                String url;
                url = ((TextView) arg1.findViewById(R.id.url)).getText().toString();
                if (url.startsWith(BrowserActivityInc.this.getString(R.string.suggestion))) {
                    url = ((TextView) arg1.findViewById(R.id.title)).getText().toString();
                } else {
                    getUrl.setText(url);
                }
                searchTheWeb(url);
                InputMethodManager imm = (InputMethodManager) getSystemService(INPUT_METHOD_SERVICE);
                imm.hideSoftInputFromWindow(getUrl.getWindowToken(), 0);
                if (mCurrentView != null) {
                    mCurrentView.requestFocus();
                }
            } catch (NullPointerException e) {
                Log.e("Browser Error: ", "NullPointerException on item click");
            }
        }

    });

    getUrl.setSelectAllOnFocus(true);
    mSearchAdapter = new SearchAdapter(this, mDarkTheme, isIncognito());
    getUrl.setAdapter(mSearchAdapter);
}
 
开发者ID:javadtaghia,项目名称:DeeBrowser,代码行数:39,代码来源:BrowserActivityInc.java


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