小编use*_*545的帖子

Android:ListView问题中的EditText

我的应用程序中有一个listview基本上是一个问卷,所以有一些用户需要填写的EditTexts.我遇到了以下问题:

  1. 一些EditText需要数字输入,所以我将相应的xml类型中的inputType设置为数字,但是,当我单击EditText时,会显示数字键盘,但几乎立即消失,并显示常规键盘.

  2. 可以想象,我需要存储用户在这些EditTexts中输入的值.我遇到的问题是,在我在SOME EditTexts中输入一些文本并向下滚动后,当我回去时文本消失了.您可以在我的代码中看到我试图阻止这一点,我应该提到它与复选框完美配合.

  3. 一开始我遇到了失去焦点的问题,但我解决了其他问题(将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)

java android

9
推荐指数
2
解决办法
9740
查看次数

包com.facebook不存在,Facebook Android SDK,IntelliJ Idea

我正在尝试编写一个使用Android SDK的Android应用.我正在使用IntelliJ Idea 12 CE.我成功之前已经这样做了,但这次我无法弄清楚我做错了什么.我做了以下事情:

  1. 我从Facebook的开发者网站下载了Facebook Android SDK,并将该模块导入IntelliJ,后者将其添加为库
  2. 我将导入的库模块作为依赖项添加到我的项目中

之后我编写代码没有问题,IntelliJ识别了导入,一切似乎都运行正常.当我尝试编译代码时,它给了我来自com.facebook的每个import语句的以下错误:

...包com.facebook不存在

这些是我对配置的一些截图:

Facebook lib

我的应用程序的配置

android facebook compilation intellij-idea

5
推荐指数
1
解决办法
1050
查看次数

标签 统计

android ×2

compilation ×1

facebook ×1

intellij-idea ×1

java ×1