I have the following problem. I am developing android app. My problem is the transition from "Portrait" to "Landscape" (transition from vertical to horizontal).
The "Portrait" display works correctly. Image appears distorted when "Landscape" is displayed. How can I solve this?
This is good...
and this is bad...
Here is my layout xml file:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent"
>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1"
android:gravity="center">
<ImageView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center"
android:src="@drawable/rsz_pprlogo"
android:textSize="36sp" />
</LinearLayout>
<LinearLayout
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1">
<LinearLayout
android:orientation="horizontal"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1"
android:gravity="center">
<ImageButton
android:id="@+id/legislativa"
android:onClick="OnButtonClick"
android:src="@drawable/rsz_legislativa"
android:
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"
android:adjustViewBounds="true"
android:background="@android:color/transparent"
android:padding="0dp"
android:scaleType="fitXY"
android:text="Button 1" />
<ImageButton
android:src="@mipmap/ic_launcher"
android:text="Button 2"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"
android:gravity="center"/>
</LinearLayout>
<LinearLayout
android:orientation="horizontal"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1"
android:gravity="center">
<ImageButton
android:src="@mipmap/ic_launcher"
android:text="Button 3"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"
android:background="@android:color/transparent"
android:padding="0dp"
android:gravity="center"/>
<ImageButton
android:src="@mipmap/ic_launcher"
android:text="Button 4"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"
android:gravity="center"/>
</LinearLayout>
<LinearLayout
android:orientation="horizontal"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1"
android:gravity="center">
<ImageButton
android:src="@mipmap/ic_launcher"
android:text="Button 5"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"
android:gravity="center"/>
<ImageButton
android:src="@mipmap/ic_launcher"
android:text="Button 6"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:gravity="center"/>
</LinearLayout>
<LinearLayout
android:orientation="horizontal"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1"
android:gravity="center">
<ImageButton
android:src="@mipmap/ic_launcher"
android:text="Button 7"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:gravity="center"/>
<ImageButton
android:src="@mipmap/ic_launcher"
android:text="Button 8"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:gravity="center"/>
</LinearLayout>
</LinearLayout>
Is there any way to fix the 'Landscape' view? Thank You.