How can I programmatically set button in right corner of EditText
?
FrameLayout fl = new FrameLayout(this);
lv.addView(fl);
searchTxt = new EditText(this);
fl.addView(searchTxt);
btnSearch = new Button(this);
I tried this
btnSearch.setGravity(Gravity.RIGHT | Gravity.CENTER_VERTICAL);
fl.addView(btnSearch);
and
LinearLayout.LayoutParams param = new LinearLayout.LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT, 0);
param.gravity = Gravity.RIGHT;
fl.addView(btnSearch, param);
But the button is still in the left corner.