放在右侧的Andr​​oid的ExpandableListView的指标 [英] Put on the right the indicator of an ExpandableListView in Android

查看:116
本文介绍了放在右侧的Andr​​oid的ExpandableListView的指标的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我必须从左边的指示器移动(因为平面图像)到右侧。我不能也成功,因为expandableviewlist里面的片段,而不是内部的整个活动。任何想法?谢谢!

I have to move the indicator from the left to the right (because of the plane image). I couldn't succeed also because the expandableviewlist is inside a fragment and not inside a whole activity. Any idea? Thanks!

推荐答案

我不知道一个办法做到这一点从XML,但我要告诉你一个方法,使动态尽在您的适配器。

I don't know a way to do that from XML but i'll tell you a way to do so dynamically in your adapter.

首先,你必须从你的XML中删除组指标

First you have to remove group indicator from your xml

 <ExpandableListView [...] 
    android:groupIndicator="@null" />

然后在你父母的布局在布局的正确位置添加一个ImageView的。

Then in your layout of the parent add an imageview in the right position of your layout.

然后在你的自定义适配器执行以下操作

Then in your custom adapter do the following

public View getGroupView(int groupPosition, boolean isExpanded,
        View convertView, ViewGroup parent) {
  ...

    if (isExpanded) {
        groupHolder.img.setImageResource(R.drawable.group_down);
    } else {
        groupHolder.img.setImageResource(R.drawable.group_up);
    }
  ...

}

这篇关于放在右侧的Andr​​oid的ExpandableListView的指标的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆