private void MoveIndicatorImage() { DisplayMetrics metrics = new DisplayMetrics(); WindowManager.DefaultDisplay.GetMetrics(metrics); int width = metrics.WidthPixels; int left = (int)(IndicatorLeft * metrics.Density + 0.5f); int right = (int)(IndicatorRight * metrics.Density + 0.5f); if (Android.OS.Build.VERSION.SdkInt >= Android.OS.BuildVersionCodes.JellyBeanMr2) { expList.SetIndicatorBoundsRelative(width - left, width - right); } else { expList.SetIndicatorBounds(width - left, width - right); } }
public override void OnViewCreated(View view, Bundle savedInstanceState) { base.OnViewCreated(view, savedInstanceState); DisplayMetrics displaymetrics = new DisplayMetrics(); Activity.WindowManager.DefaultDisplay.GetMetrics(displaymetrics); int screenWidth = displaymetrics.WidthPixels; int leftPadding = IsRTL() ? -70 : 70; int rightPadding = IsRTL() ? 30 : -115; var width = DpToPx(302); int leftWidth = width - DpToPx(leftPadding); int rightWidth = width - DpToPx(rightPadding); if (Build.VERSION.SdkInt < BuildVersionCodes.JellyBeanMr2) { listView.SetIndicatorBounds(leftWidth, rightWidth); } else { listView.SetIndicatorBoundsRelative(leftWidth, rightWidth); } }
public override void OnWindowFocusChanged(bool hasFocus) { base.OnWindowFocusChanged(hasFocus); ExpandableListView.SetIndicatorBounds((int)(ExpandableListView.Width - 30 * Resources.DisplayMetrics.Density), (int)(ExpandableListView.Width - 2 * Resources.DisplayMetrics.Density)); }