Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/android/226.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 展开组时ExpandableListView项切换位置_Android - Fatal编程技术网

Android 展开组时ExpandableListView项切换位置

Android 展开组时ExpandableListView项切换位置,android,Android,我在fragment中使用ExpandableListView,在我展开具有某些选定值(即橙色)的组之前,一切正常 现在,在扩展一个组后,例如祈祷提醒,它看起来是这样的 请注意,红色矩形中的项目已切换位置 下面是我的getGroupView()和getChildView()方法 @Override public View getGroupView(int groupPosition, boolean isExpanded, View convertView, ViewGroup pare

我在fragment中使用ExpandableListView,在我展开具有某些选定值(即橙色)的组之前,一切正常

现在,在扩展一个组后,例如祈祷提醒,它看起来是这样的

请注意,红色矩形中的项目已切换位置

下面是我的
getGroupView()
getChildView()
方法

@Override
    public View getGroupView(int groupPosition, boolean isExpanded, View convertView, ViewGroup parent) {
        if (convertView == null) {
            convertView = LayoutInflater.from(context).inflate(R.layout.prayer_settings_list_item, parent, false);
        }
        ((TextView) convertView.findViewById(R.id.setting_name_tv)).setText((String) getGroup(groupPosition));
        return convertView;
    }


@Override
    public View getChildView(int groupPosition, final int childPosition, boolean isLastChild, View convertView, ViewGroup parent) {
        LayoutInflater layoutInflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
                convertView = layoutInflater.inflate(R.layout.azan_selection_item, parent, false);

                MontserratRegTextView azanVoiceMakkahTv = (MontserratRegTextView) convertView.findViewById(R.id.azan_voice_tv);
                final ImageView icPlayPause = (ImageView) convertView.findViewById(R.id.azan_play_ic);
                icPlayPause.setOnClickListener(new View.OnClickListener() {
                    @Override
                    public void onClick(View v) {
                        PrayerSettingsFragment.listener.onClick(childPosition, icPlayPause);
                    }
                });
                String azanVoice = (String) getChild(groupPosition, childPosition);
                azanVoiceMakkahTv.setText(azanVoice);


        return convertView;
    }

嗨,我有同样的问题,我通过从getGroupView方法中删除此条件
if(convertView==null)
来修复它。嗨,我有同样的问题,我通过从getGroupView方法中删除此条件
if(convertView==null)
来修复它