扩展列表视图中移动组图标指示向右软糖4.3版本?组图、软糖、视图、中移动

2023-09-13 00:00:05 作者:很酷的小仙女

下面的方法是不工作在Android版本4.3软糖

The below method is not working in android version jellybean 4.3.

historyExpaLV.setIndicatorBounds(historyExpaLV.getRight() - 60,
                    historyExpaLV.getWidth() - 8);    

有谁知道解决的办法?先谢谢了。

Does anyone know the solution? Thanks in advance.

推荐答案

我该如何解决了这个问题:

How I fixed this:

更新SDK管理器到Android 4.3,并把它作为构建目标。他们推出的API 18日,被称为一个新的方法 setIndicatorBoundsRelative(INT,INT),这在安卓4.3可以作为其他的(但正确)。

Update SDK Manager to Android 4.3 and use it as build target. They introduced a new method in the API 18, called setIndicatorBoundsRelative(int, int), which works as the other (but correctly) in android 4.3.

请了Android版本的检查,并使用旧方法与旧的API:

Make a check for Android version and use the old method with older API:

if(android.os.Build.VERSION.SDK_INT < android.os.Build.VERSION_CODES.JELLY_BEAN_MR2) {
   mListView.setIndicatorBounds(myLeft, myRight);
} else {
   mListView.setIndicatorBoundsRelative(myLeft, myRight);
}