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


Java AutoCompleteTextView.setDropDownWidth方法代码示例

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


在下文中一共展示了AutoCompleteTextView.setDropDownWidth方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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: applyStyle

import android.widget.AutoCompleteTextView; //导入方法依赖的package包/类
private static void applyStyle(AutoCompleteTextView v, int styleRes){
    TypedArray a = v.getContext().obtainStyledAttributes(null, R.styleable.AutoCompleteTextView, 0, styleRes);

    int n = a.getIndexCount();
    for (int i = 0; i < n; i++) {
        int attr = a.getIndex(i);

        if(attr == R.styleable.AutoCompleteTextView_android_completionHint)
            v.setCompletionHint(a.getString(attr));
        else if(attr == R.styleable.AutoCompleteTextView_android_completionThreshold)
            v.setThreshold(a.getInteger(attr, 0));
        else if(attr == R.styleable.AutoCompleteTextView_android_dropDownAnchor)
            v.setDropDownAnchor(a.getResourceId(attr, 0));
        else if(attr == R.styleable.AutoCompleteTextView_android_dropDownHeight)
            v.setDropDownHeight(a.getLayoutDimension(attr, ViewGroup.LayoutParams.WRAP_CONTENT));
        else if(attr == R.styleable.AutoCompleteTextView_android_dropDownWidth)
            v.setDropDownWidth(a.getLayoutDimension(attr, ViewGroup.LayoutParams.WRAP_CONTENT));
        else if(attr == R.styleable.AutoCompleteTextView_android_dropDownHorizontalOffset)
            v.setDropDownHorizontalOffset(a.getDimensionPixelSize(attr, 0));
        else if(attr == R.styleable.AutoCompleteTextView_android_dropDownVerticalOffset)
            v.setDropDownVerticalOffset(a.getDimensionPixelSize(attr, 0));
        else if(attr == R.styleable.AutoCompleteTextView_android_popupBackground)
            v.setDropDownBackgroundDrawable(a.getDrawable(attr));
    }
    a.recycle();
}
 
开发者ID:rey5137,项目名称:chameleon,代码行数:27,代码来源:ViewStyler.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) {

    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

示例4: applyStyle

import android.widget.AutoCompleteTextView; //导入方法依赖的package包/类
/**
 * Apply any AutoCompleteTextView style attributes to a view.
 * @param v
 * @param attrs
 * @param defStyleAttr
 * @param defStyleRes
 */
private static void applyStyle(AutoCompleteTextView v,  AttributeSet attrs, int defStyleAttr, int defStyleRes){
    TypedArray a = v.getContext().obtainStyledAttributes(attrs, R.styleable.AutoCompleteTextView, defStyleAttr, defStyleRes);

    int n = a.getIndexCount();
    for (int i = 0; i < n; i++) {
        int attr = a.getIndex(i);

        if(attr == R.styleable.AutoCompleteTextView_android_completionHint)
            v.setCompletionHint(a.getString(attr));
        else if(attr == R.styleable.AutoCompleteTextView_android_completionThreshold)
            v.setThreshold(a.getInteger(attr, 0));
        else if(attr == R.styleable.AutoCompleteTextView_android_dropDownAnchor)
            v.setDropDownAnchor(a.getResourceId(attr, 0));
        else if(attr == R.styleable.AutoCompleteTextView_android_dropDownHeight)
            v.setDropDownHeight(a.getLayoutDimension(attr, ViewGroup.LayoutParams.WRAP_CONTENT));
        else if(attr == R.styleable.AutoCompleteTextView_android_dropDownWidth)
            v.setDropDownWidth(a.getLayoutDimension(attr, ViewGroup.LayoutParams.WRAP_CONTENT));
        else if(attr == R.styleable.AutoCompleteTextView_android_dropDownHorizontalOffset)
            v.setDropDownHorizontalOffset(a.getDimensionPixelSize(attr, 0));
        else if(attr == R.styleable.AutoCompleteTextView_android_dropDownVerticalOffset)
            v.setDropDownVerticalOffset(a.getDimensionPixelSize(attr, 0));
        else if(attr == R.styleable.AutoCompleteTextView_android_popupBackground)
            v.setDropDownBackgroundDrawable(a.getDrawable(attr));
    }
    a.recycle();
}
 
开发者ID:XhinLiang,项目名称:MDPreference,代码行数:34,代码来源:ViewUtil.java

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

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