I have a simple layout, which shows a text and a image:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:background="#ffffff"
>
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:gravity="center"
>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:gravity="center"
android:text="TEST"
android:textColor="#0099cc"
/>
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:tint="#55ff0000"
android:src="@drawable/my_image"/>
</LinearLayout>
</LinearLayout>
I would like the image to be shown only when the device is in Portrait mode.
What I mean is if the device is in landscape mode, I would like to not only just hide the image, but remove the image completely from the layout. How to do it?
You can specify two layouts: one fort portrait mode, placed in layout-port folder, and one for landscape mode, placed in layout-land folder. Hope this helps.