我的应用程序中有一个AutoCompleteTextView.该应用程序使用Facebook SDK.我按照SO:https://stackoverflow.com/a/12363961/450534这个问题的代码跟踪了点,并且有一个功能正常的搜索(过滤)活动.
现在,如何在键入@符号后获得类似Facebook App的内联自动完成功能,并且仍然保留用户键入的其他文本?有问题的活动是针对状态更新,可以包含用户的好友以及其他文本.的AutoCompleteTextView或EditText自然会多行之一.有关状态更新,请参阅.
我知道由于这篇文章中没有任何代码,我可能会被投票或甚至关闭问题.但它确实是一个标准的锅炉板列表过滤代码.
编辑:Android 的FriendCaster应用程序也是如此.
我正在尝试为授权活动编写代码.当我在inputEmail中输入一些条目时,如果存在相应的记录,我希望我的inputPasword将自动归档.但是onItemSelectedListener似乎不起作用.当我选择项目时没有任何反应.日志没有.我想知道我是否犯了一些错误,或者我错了.
AutoCompleteTextView inputEmail;
inputEmail = (AutoCompleteTextView) findViewById(R.id.loginEmail);
inputEmail.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
// TODO Auto-generated method stub
Set<String> keys = prefs.getAll().keySet();
emails.clear();
if (keys.size() != 0) {
emails.addAll(keys);
} else
emails.add("");
inputEmail.setAdapter(adapter);
email = inputEmail.getText().toString();
}
});
inputEmail.setOnItemSelectedListener(new OnItemSelectedListener() {
@Override
public void onItemSelected(AdapterView<?> arg0, View arg1,
int arg2, long arg3) {
// TODO Auto-generated method stub
email = inputEmail.getText().toString();
password = prefs.getString(email, "");
Log.d(email + " "+password, "email+password");
if (password.length() > 1) {
inputPassword.setText(password);
} …Run Code Online (Sandbox Code Playgroud) 我有3个autocompletetextview,我把它的适配器设置为ArrayAdapter<String>一个非常简单的textview布局.
的autocompletextview提示的结果是示出,但是屏幕上键盘下(我可以看到它的一部分).我怎样才能使结果显示在上方autocompletetextview而不是下方?
airline = (AutoCompleteTextView)findViewById(R.id.airline);
airline.setAdapter(new ArrayAdapter<String>(this, R.layout.autcomplete_dropdown, AIRLINES_AUTOCOMPLETE_ARRAY));
departLocation = (AutoCompleteTextView)findViewById(R.id.departLocation);
departLocation.setAdapter(new ArrayAdapter<String>(this, R.layout.autcomplete_dropdown, LOCATIONS_AUTOCOMPLETE_ARRAY));
arriveLocation = (AutoCompleteTextView)findViewById(R.id.arriveLocation);
arriveLocation.setAdapter(new ArrayAdapter<String>(this, R.layout.autcomplete_dropdown, LOCATIONS_AUTOCOMPLETE_ARRAY));
Run Code Online (Sandbox Code Playgroud) 我有一个AutoCompleteTextView,它可以从Google Places API中为用户提供自动完成搜索结果.完成后,我发现了SearchView以及它如何放在ActionBar中.我查看了谷歌提供的SearchView示例,并将其作为起点添加到我的应用程序中(它列出了已安装的应用程序),但我不知道如何从这里开始.我希望具有与AutoCompleteTextView相同的功能,但使用SearchView.有什么建议吗?全班提供如下.
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.net.URL;
import java.net.URLConnection;
import java.net.URLEncoder;
import java.util.ArrayList;
import java.util.List;
import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;
import android.app.Activity;
import android.app.SearchManager;
import android.app.SearchableInfo;
import android.content.Context;
import android.content.Intent;
import android.content.SharedPreferences;
import android.content.SharedPreferences.OnSharedPreferenceChangeListener;
import android.os.AsyncTask;
import android.os.Bundle;
import android.os.Handler;
import android.preference.PreferenceManager;
import android.text.Editable;
import android.text.TextWatcher;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.Menu;
import android.view.MenuInflater;
import android.view.MenuItem;
import android.view.View;
import android.view.Window;
import android.view.animation.Animation;
import android.view.animation.AnimationUtils;
import android.widget.AdapterView;
import …Run Code Online (Sandbox Code Playgroud) 我已经提供了一个AutoCompleteTextView向用户显示建议.根据用户选择的项目,我获取项目的ID并在数据库中使用它.现在我的问题是强制用户仅从中进行选择AutoCompleteTextView(即用户不应输入自己的文本).这是客户要求.这该怎么做?
我TextInputLayout在我的Android应用程序中使用,以便为我的输入字段实现整洁的浮动标签效果.我知道我也应该使用它TextInputEditText来允许在横向模式下显示提示并且输入填满整个屏幕.
但是,在我的一些输入字段中,我已经使用了自动完成AutoCompleteTextView(IMO的名称确实不一致 - "TextView"而不是"EditText" - 但这是另一个故事)并且显然是直接继承的EditText.因此它没有带来的功能TextInputEditText.
所以我想知道是否有办法实现相同的景观功能(没有自己的TextInputAutoCompleteTextView实现,也就是这样),并且还避免产生的lint警告.我在这里错过了什么吗?我想我得到的是他们没有EditText为这个特定事物制作所有直接和间接子类的自定义版本,所以我希望自己制作?
android autocomplete autocompletetextview android-edittext android-textinputlayout
我目前正在撰写的应用程序处理地点.创建场所的主要方法是输入地址.提供便捷的方法对于UX来说非常重要.
在调查问题一段时间后,我得出的结论是,最好的方法是根据当前位置和用户输入自动完成的文本区域(如Google Map应用程序中).由于Google Map API不提供此功能,因此我必须自行实施.
为了获得地址建议我使用Geocoder.这些建议由自定义ArrayAdaptor通过自定义过滤器提供给AutoCompleteTextView.
ArrayAdapter(某些代码已被删除)
public class AddressAutoCompleteAdapter extends ArrayAdapter<Address> {
@Inject private LayoutInflater layoutInflater;
private ArrayList<Address> suggested;
private ArrayList<Address> lastSuggested;
private String lastInput = null;
private AddressLoader addrLoader;
public AddressAutoCompleteAdapter(Activity activity,
AddressLoaderFactory addrLoaderFact,
int maxSuggestionsCount) {
super(activity,R.layout.autocomplete_address_item);
suggested = new ArrayList<Address>();
lastSuggested = new ArrayList<Address>();
addrLoader = addrLoaderFact.create(10);
}
...
@Override
public Filter getFilter() {
Filter myFilter = new Filter() {
...
@SuppressWarnings("unchecked")
@Override
protected FilterResults …Run Code Online (Sandbox Code Playgroud) android autocomplete autocompletetextview android-arrayadapter
我在我的Android应用程序中使用了AutoCompleteTextView,它运行正常.我面临的唯一问题是默认情况下建议的颜色是白色的,我无法看到任何建议.因此,当我开始输入内容时,列表会扩展为带有白色条目(不可见),但是当我点击任何项目时,我发现它正在按原样运行.只有颜色似乎是问题.我使用以下代码.
<AutoCompleteTextView android:id="@+id/location" android:textColor="#000000"
android:layout_width="fill_parent" android:layout_height="wrap_content"></AutoCompleteTextView>
Run Code Online (Sandbox Code Playgroud)
和
ArrayAdapter<String> autoadapter=new ArrayAdapter<String>(this,android.R.layout.simple_dropdown_item_1line,cities);
city = (AutoCompleteTextView) findViewById(R.id.location);
city.setAdapter(autoadapter);
city.setThreshold(1);
city.setTextColor(Color.BLACK);
Run Code Online (Sandbox Code Playgroud)
谁能告诉我这是什么问题?
-提前致谢
我正在为AutoCompleteTextView选择文本.我想将setonclicklistener应用于所选文本.如果有任何想法.
ArrayAdapter<String> arrAdapter = new ArrayAdapter<String>(this, android.R.layout.simple_dropdown_item_1line, sampleACTV);
AutoCompleteTextView ACTV = (AutoCompleteTextView) findViewById(R.id.spinner);
ACTV.setAdapter(arrAdapter);
}
private static final String[] sampleACTV = new String[]
{ "android","androidpeople.com","iphone","blackberry" };
Run Code Online (Sandbox Code Playgroud)
在我的例子中,我正在选择一个像android召唤意图去嵌套Acitivity
在这里打破我的头脑,我在网上搜索了很多,似乎这是Android上的一个错误,但尚未找到解决方案.
我有一个AutoCompleteTextView:
autodesignations = (AutoCompleteTextView) findViewById(R.id.main_autocomp);
adapterShapesAuto = new ArrayAdapter<String>(this,android.R.layout.simple_dropdown_item_1line, shapes);
autodesignations.setAdapter(adapterShapes);
Run Code Online (Sandbox Code Playgroud)
小部件工作,但下拉文本始终是白色背景上的白色文本.
我已经尝试将适配器的资源设置为android的内置布局的几种组合以及我自己的布局.
甚至将它指向一个TextView资源也可用于Spinner(按预期工作,白色背景上的黑色文本),但却发现无法使其工作,继续得到相同的结果
有帮助吗?
android widget android-widget autocompletetextview drop-down-menu