Spinners need to be Right aligned on the Screen
I tried to use everything like setGravity and other, Nothing worked.
I tried to search also a lot for this Right alignment, everywhere solution is available in XML format but NOT in Java format. Can someone Please help :)
Code
final LinearLayout lm = (LinearLayout) findViewById(R.id.linearLayout1);
LinearLayout ll = new LinearLayout(this);
ll.setOrientation(LinearLayout.HORIZONTAL);
final Spinner spinner = new Spinner(this);
spinner.setOnItemSelectedListener(this);
ArrayAdapter<String> dataAdapter = new ArrayAdapter<String>(this, android.R.layout.simple_spinner_item, categories);
dataAdapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
spinner.setAdapter(dataAdapter);
spinner.setEnabled(false);
ll.addView(spinner);
lm.addView(ll);
Abir : Now its showing this.