9

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.

asteri
  • 11,402
  • 13
  • 60
  • 84
pavan kumar
  • 103
  • 1
  • 1
  • 6

2 Answers2

31

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);
}
luben
  • 2,512
  • 4
  • 30
  • 41
5

i think it's bug

int right = (int) (getResources().getDisplayMetrics().widthPixels - TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 30, getResources().getDisplayMetrics()));
    expandableListView.setIndicatorBounds(right - getResources().getDrawable(R.drawable.group_indicator_padding).getIntrinsicWidth(), right);

this code works fine up to 4.2.2 and do nothing on 4.3

Alessandro Scarozza
  • 4,273
  • 6
  • 31
  • 39