I need to change the visibility of a layout in xml when the orientation of the device is from portrait to landscape. I want to add 2 columns when performing this action. I used the code android:visibility="gone"
to hide, but I can not find a way to change to android:visibility="visibility"
when the orientation is changed.
Follow the full code below.
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="1"
android:orientation="vertical"
android:visibility="gone">
<Button
android:id="@+id/btnPer"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="1"
android:background="@drawable/button_green"
android:text="@string/Btn_Per"
android:textColor="@color/gray"
android:textSize="18sp" />
<Button
android:id="@+id/btnQuad"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="1"
android:background="@drawable/button_green"
android:text="@string/Btn_Quad"
android:textColor="@color/gray"
android:textSize="18sp" />
<Button
android:id="@+id/btnRaiz"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="1"
android:background="@drawable/button_green"
android:text="@string/Btn_Raiz"
android:textColor="@color/gray"
android:textSize="18sp" />
<Button
android:id="@+id/btnUm"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="1"
android:background="@drawable/button_green"
android:text="@string/Btn_Um"
android:textColor="@color/gray"
android:textSize="18sp" />
<Button
android:id="@+id/btnMod"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="1"
android:background="@drawable/button_green"
android:text="@string/Btn_Mod"
android:textColor="@color/gray"
android:textSize="18sp" />
</LinearLayout>