1

How to reduce spinner size like this, reduce it's width & move it's alignment to right. Please refer below screenshots

What I want is below

I want spinner style like this

What I get...

What I get

Kiran Koravi
  • 164
  • 2
  • 11
  • Possible duplicate of [How to limit the height of Spinner drop down view in Android](http://stackoverflow.com/questions/20597584/how-to-limit-the-height-of-spinner-drop-down-view-in-android) – Ankita Shah Mar 10 '17 at 12:03
  • @AnkitaShah Height is not a problem for me. I want reduce width of spinner. Like half of parent width. Please help me – Kiran Koravi Mar 10 '17 at 12:09
  • Set Width of spinner `Display display = getWindowManager().getDefaultDisplay(); DisplayMetrics outMetrics = new DisplayMetrics(); display.getMetrics(outMetrics); int leftPaneWidth = outMetrics.widthPixels / 2;popupWindow.setWidth(leftPaneWidth );` – Ankita Shah Mar 10 '17 at 12:18
  • 1
    Thanks @AnkitaShah I've achieved this using setDropDownWidth() property of spinner – Kiran Koravi Mar 10 '17 at 12:34

1 Answers1

0

Set Width of spinner

Display display = getWindowManager().getDefaultDisplay(); DisplayMetrics outMetrics = new DisplayMetrics(); display.getMetrics(outMetrics); int width = outMetrics.widthPixels / 2; popupWindow.setWidth(width);

Ankita Shah
  • 1,866
  • 16
  • 31