I have an standalone ImageButton defined in xml with the following:
<ImageButton xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/btnTourStartGame"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_centerHorizontal="true"
android:layout_marginBottom="32dp"
android:background="@drawable/tour_btn_start"/>
This ImageButton is then dynamically inflated in a fragment with the following code. (Note: ltTourScreenLast is a Relative Layout.)
ImageButton startButton = (ImageButton) inflater.inflate(R.layout.button_tour_start, ltTourScreenLast, false);
startButton.setOnClickListener(this);
ltTourScreenLast.addView(startButton);
Currently, the android:layout_marginBottom attribute seems to be ignored when this button is inflated and the button sits directly at the bottom of the screen.
My intention is to have the button sit 32dp from the bottom of the screen. How do I achieve this?
I've referred to the following post but to no avail: Layout problem with button margin (Sidenote: I attempted testing out layout_marginLeft on my ImageButton and it seems to work. layout_marginBottom doesn't though.)