FrameLayout.LayoutParams params = new FrameLayout.LayoutParams(FrameLayout.LayoutParams.MATCH_PARENT, FrameLayout.LayoutParams.MATCH_PARENT);
params.gravity = Gravity.BOTTOM;
myFrameLayout.setLayoutParams(params);
I have only a text-view inside my frame-layout and I want to set its gravity to bottom dynamically in some condition. I am trying with this code but its not working.
<FrameLayout
android:id="@+id/container"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_gravity="top|center_horizontal">
<TextView
android:id="@+id/preview_content"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
</FrameLayout>