I have frame layout and inside of it linear layout with four buttons. When i write in xml works great but i want to write in java code.
THIS WORKS
<FrameLayout ...
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:layout_gravity="bottom">
<ImageButton
android:id="@+id/button1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Button" />
<ImageButton
android:id="@+id/button2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Button" />
<ImageButton
android:id="@+id/button3"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Button" />
</LinearLayout>
</FrameLayout>
BUT THIS DOESN't WORK
tbr = new LinearLayout(getBaseContext());
LinearLayout.LayoutParams pa = new LinearLayout.LayoutParams(LinearLayout.LayoutParams.MATCH_PARENT,LinearLayout.LayoutParams.WRAP_CONTENT);
pa.gravity = Gravity.BOTTOM; ///??
tbr.setLayoutParams(pa);
FrameLayout fl = findbyid... f1.addView(tbr);