Expandable list view move group icon indicator to right in jellyBean 4.3 version?

后端 未结 2 1783
野趣味
野趣味 2020-12-14 12:35

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

historyExpaLV.setIndicatorBounds(historyExpaLV.getRight() - 60,
                    history         


        
2条回答
  •  -上瘾入骨i
    2020-12-14 13:06

    How I fixed this:

    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.

    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);
    }
    

提交回复
热议问题