Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/typo3/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Android Commonware拖放永久收缩行高度_Android_Commonsware Cwac - Fatal编程技术网

Android Commonware拖放永久收缩行高度

Android Commonware拖放永久收缩行高度,android,commonsware-cwac,Android,Commonsware Cwac,我确实进行了拖放操作,TouchListView类工作得很好。然而,在我的例子中,由于适配器包含可以有多行的EditText,所以我有不同高度的行。因此,在我下降后,我的所有行都转换为tlv:normal_高度,在我的情况下,该高度为74dip。这会导致许多行在编辑文本中删除我的所有文本。我尝试重新初始化我的适配器(mylistview.setAdapter=myadapter),将ListView设置为GONE then VISIBLE and invalidateViews(),但在我拖动之

我确实进行了拖放操作,TouchListView类工作得很好。然而,在我的例子中,由于适配器包含可以有多行的EditText,所以我有不同高度的行。因此,在我下降后,我的所有行都转换为tlv:normal_高度,在我的情况下,该高度为74dip。这会导致许多行在编辑文本中删除我的所有文本。我尝试重新初始化我的适配器(mylistview.setAdapter=myadapter),将ListView设置为GONE then VISIBLE and invalidateViews(),但在我拖动之前,似乎没有任何东西将ListView重置回原来的状态,除了离开活动并返回。这里可以做什么-Thx

tlv:normal_height="74dip"
tlv:expanded_height="128dip"

毫无疑问,最初的AOSP代码是为统一的行高而设计的,而整个
扩展的_height
结构是为了给用户提供空间,让他们能够直观地看到下落的位置

一个起点可能是创建一个
TouchListAdapter
mixin接口(类似于
SpinnerAdapter
),其中
正常高度
扩展高度
将基于
位置
从适配器动态检索,而不是在布局中声明的固定值。单凭这一点就足够了,还是需要做更多的工作,我不能说

如果您提出了解决方案,欢迎使用补丁。否则,我可能会在某个时候看看这个,但不会很快

很抱歉没有近期的银弹。

我编辑了unExpandViews()方法,称为getAdapter(),并将适配器中的每个项目的高度设置为0,然后将所有行设置回原始值。我还绕过了方法的删除部分,因为它不适用于我

private void unExpandViews(boolean deletion) {

            int height_saved = 0;

            CheckBoxifiedTextListAdapter cbla = (CheckBoxifiedTextListAdapter)getAdapter();

            for (int i = 0;i < cbla.getCount(); i++) 
            {
                    //View v = getChildAt(i);

                    View v = cbla.getView(i, null, null);

                    //if (v == null) 
                    //{      
                           /*
                            if (deletion) 
                            {
                                    // HACK force update of mItemCount
                                    int position = getFirstVisiblePosition();
                                    int y = getChildAt(0).getTop();
                                    setAdapter(getAdapter());
                                    setSelectionFromTop(position, y);
                                    // end hack
                            }
                            layoutChildren(); // force children to be recreated where needed
                            v = getChildAt(i);

                            if (v == null) 
                            {
                                    break;
                            }
                            height_saved = v.getHeight();
                            */
                    //}
                    //else

                    //height_saved = v.getHeight();

                    if (isDraggableRow(v)) 
                    {
                        ViewGroup.LayoutParams params = v.getLayoutParams();
                        params.height = 0;
                        v.setLayoutParams(params);
                        v.setVisibility(View.VISIBLE);
                    }
            }
    }
private void unexpandview(布尔删除){
int height_saved=0;
CheckBoxifiedTextListAdapter cbla=(CheckBoxifiedTextListAdapter)getAdapter();
对于(int i=0;i
我明白了,谢谢。我将查看是否可以编辑TouchListView类,并查看是否可以根据ListView项的高度动态设置行高度。我假设我可以从TouchListView类访问ListView适配器-那么你能告诉我代码中的正确位置吗?@Mike:使用
getAdapter()
获取适配器。