Java method for android:layout_gravity
- by André Leitão
Hi folks,
I would like to know if is there a way to call android:layout_gravity property from a java method. I didn't found any method in Android documentation to do it. This is the picture of the layout I want to implement:
I know to do it through xml, as following:
<FrameLayout
xlmns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="wrap_content">
<Button
android:layout_gravity="left|center_vertical"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="<" />
<Button
android:layout_gravity="right|center_vertical"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text=">" />
</FrameLayout>
But in my situation, I need to do it through Java code, because I'll implement another layout views dinamically. To avoid merging xml layout with Java code, I would prefer make all layout using Java.
Can you help me?
Thanks.
André Leitão