我的应用程序中有一个listview基本上是一个问卷,所以有一些用户需要填写的EditTexts.我遇到了以下问题:
一些EditText需要数字输入,所以我将相应的xml类型中的inputType设置为数字,但是,当我单击EditText时,会显示数字键盘,但几乎立即消失,并显示常规键盘.
可以想象,我需要存储用户在这些EditTexts中输入的值.我遇到的问题是,在我在SOME EditTexts中输入一些文本并向下滚动后,当我回去时文本消失了.您可以在我的代码中看到我试图阻止这一点,我应该提到它与复选框完美配合.
一开始我遇到了失去焦点的问题,但我解决了其他问题(将descendantFocusablity ="beforeDescendants"添加到ListView和windowSoftInputMode ="adjustPan").工作正常,但当EditText低于屏幕的一半时,一旦我开始输入它就会失去焦点. 列表适配器的getView方法:
public View getView(final int position,View result,ViewGroup parent)
{
final ViewHolder vh;
final Question question = values.get(position);
if(holders[position]==null)
vh = new ViewHolder();
else
vh = holders[position];
LayoutInflater inflater = (LayoutInflater)context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
if(question.getQuestionType().equals(Question.TYPE_CLOSED))
{
result = inflater.inflate(R.layout.closed_question_list_item, null);
vh.cb = (CheckBox)result.findViewById(R.id.checkbox);
vh.cb.setOnCheckedChangeListener(new OnCheckedChangeListener()
{
@Override
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked)
{
vh.isChecked = isChecked;
holders[position] = vh;
}
});
vh.cb.setChecked(vh.isChecked);
}
else
{
result = inflater.inflate(R.layout.numeric_question_list_item, null);
vh.et = (EditText)result.findViewById(R.id.question_et);
vh.et.addTextChangedListener(new TextWatcher()
{
@Override …Run Code Online (Sandbox Code Playgroud)我正在尝试编写一个使用Android SDK的Android应用.我正在使用IntelliJ Idea 12 CE.我成功之前已经这样做了,但这次我无法弄清楚我做错了什么.我做了以下事情:
之后我编写代码没有问题,IntelliJ识别了导入,一切似乎都运行正常.当我尝试编译代码时,它给了我来自com.facebook的每个import语句的以下错误:
...包com.facebook不存在
这些是我对配置的一些截图: