关于可扩展列表视图,组图标指示器位于左侧,我可以移动指示器并将其定位在右侧吗?谢谢.
编辑:由于我不想扩展视图,我得到了动态获取宽度的解决方法.只是分享我的解决方案
Display newDisplay = getWindowManager().getDefaultDisplay(); int width = newDisplay.getWidth(); newListView.setIndicatorBounds(width-50, width);

我必须从左到右移动指示器(因为平面图像).我也无法成功,因为expandableviewlist位于片段内,而不是整个活动内.任何的想法?谢谢!
可展开的Listview SetIndicatorBounds在我的项目代码中不起作用.
这是我的布局:
<LinearLayout
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:gravity="center|center_vertical"
android:weightSum="1.0"
>
<ExpandableListView
android:id="@+id/custom_list"
android:layout_width="match_parent"
android:layout_height="0dp"
android:dividerHeight="1dp"
android:layout_weight="1"
android:paddingBottom="0dp"
android:divider="#b5b5b5"
/>
</LinearLayout>
Run Code Online (Sandbox Code Playgroud)
这是我的代码:
lv1 = (ExpandableListView) findViewById(R.id.custom_list);
DisplayMetrics metrics = new DisplayMetrics();
getWindowManager().getDefaultDisplay().getMetrics(metrics);
int width = metrics.widthPixels;
lv1.setIndicatorBounds(width - GetPixelFromDips(50), width - GetPixelFromDips(10));
public int GetPixelFromDips(float pixels) {
// Get the screen's density scale
final float scale = getResources().getDisplayMetrics().density;
// Convert the dps to pixels, based on density scale
return (int) (pixels * scale + 0.5f);
}
Run Code Online (Sandbox Code Playgroud)
我的Moto G kitkat设备宽度为720.但是setIndicatorBounds似乎没有在我的Kitkat设备中解决.
任何帮助将不胜感激.
谢谢,