在Android中将ExpandableListView的指示器放在右侧 [英] Put on the right the indicator of an ExpandableListView in Android
问题描述
我必须从左到右移动指示器(因为平面图像).我也无法成功,因为 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" />
然后在您的父布局中,在布局的正确位置添加一个图像视图.
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);
}
...
}
这篇关于在Android中将ExpandableListView的指示器放在右侧的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!