Witajcie,
problem: na podglądzie w android studio layout wyswietla się tak jak po lewej, ale na urządzeniu fizycznym już tak nie jest...?
Co robię nie tak? Jak doprowadzić do sytuacji, w której podgląd będzie się zgadzał z faktycznym wyglądem na telefonie? Całość layoutu oparta jest na zagnieżdżonych Linear Layoutach a kod całości podaję poniżej:
<?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"
android:padding="0dp">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="2">
<TextView
android:text="@string/txt_splash_screen"
android:layout_marginLeft="30dp"
android:layout_marginRight="30dp"
android:textAlignment="center"
android:textSize="40sp"
android:textColor="@color/colorPrimary"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/txtSplashScreen" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1"
android:orientation="horizontal"
android:padding="20dp">
<RelativeLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1">
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/btn_europa"
android:id="@+id/btn_europa"
/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/txt_btn_europa"
android:layout_below="@id/btn_europa"
android:layout_centerHorizontal="true"
android:textColor="@color/colorButton"
android:id="@+id/txt_btn_europa"/>
</RelativeLayout>
<RelativeLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1">
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/btn_europa"
android:id="@+id/btn_europa"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/txt_btn_europa"
android:layout_below="@id/btn_europa"
android:layout_centerHorizontal="true"
android:textColor="@color/colorButton"
android:id="@+id/txt_btn_europa"/>
</RelativeLayout>
<RelativeLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1">
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/btn_europa"
android:id="@+id/btn_europa"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/txt_btn_europa"
android:layout_below="@id/btn_europa"
android:layout_centerHorizontal="true"
android:textColor="@color/colorButton"
android:id="@+id/txt_btn_europa"/>
</RelativeLayout>
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1"
android:orientation="horizontal"
android:padding="20dp">
<RelativeLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1">
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/btn_europa"
android:id="@+id/btn_europa"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/txt_btn_europa"
android:layout_below="@id/btn_europa"
android:layout_centerHorizontal="true"
android:textColor="@color/colorButton"
android:id="@+id/txt_btn_europa"/>
</RelativeLayout>
<RelativeLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1">
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/btn_europa"
android:id="@+id/btn_europa"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/txt_btn_europa"
android:layout_below="@id/btn_europa"
android:layout_centerHorizontal="true"
android:textColor="@color/colorButton"
android:id="@+id/txt_btn_europa"/>
</RelativeLayout>
<RelativeLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1">
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/btn_europa"
android:id="@+id/btn_europa"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/txt_btn_europa"
android:layout_below="@id/btn_europa"
android:layout_centerHorizontal="true"
android:textColor="@color/colorButton"
android:id="@+id/txt_btn_europa"/>
</RelativeLayout>
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1"
android:orientation="horizontal"
android:padding="20dp">
<RelativeLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1">
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/btn_europa"
android:id="@+id/btn_europa"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/txt_btn_europa"
android:layout_below="@id/btn_europa"
android:layout_centerHorizontal="true"
android:textColor="@color/colorButton"
android:id="@+id/txt_btn_europa"/>
</RelativeLayout>
<RelativeLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1">
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/btn_europa"
android:id="@+id/btn_europa"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/txt_btn_europa"
android:layout_below="@id/btn_europa"
android:layout_centerHorizontal="true"
android:textColor="@color/colorButton"
android:id="@+id/txt_btn_europa"/>
</RelativeLayout>
<RelativeLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1">
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/btn_europa"
android:id="@+id/btn_europa"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/txt_btn_europa"
android:layout_below="@id/btn_europa"
android:layout_centerHorizontal="true"
android:textColor="@color/colorButton"
android:id="@+id/txt_btn_europa"/>
</RelativeLayout>
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1">
<TextView
android:text="@string/txt_splash_screen"
android:layout_marginLeft="30dp"
android:layout_marginRight="30dp"
android:textAlignment="center"
android:textSize="40sp"
android:textColor="@color/colorPrimary"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/txtSplashScreen" />
</LinearLayout>
</LinearLayout>
Będę wdzięczny za pomoc.
Pozdrawiam
Marcin
dodana zawartość
Problem rozwiązany. Kod:
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical" android:layout_width="match_parent"
android:layout_height="match_parent">
<TextView
android:text="@string/txt_wybor_nauka"
android:textAlignment="center"
android:textSize="30sp"
android:textColor="@color/colorWhite"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="25dp"
android:layout_marginBottom="25dp"
android:id="@+id/txtEkranWyboruNauka"
android:layout_alignParentTop="true"/>
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@drawable/bg_ekran_wyboru_obszaru"
android:layout_below="@+id/txtEkranWyboruNauka"
android:layout_above="@+id/btnWsteczEkranWyboruNauka"
android:padding="10dp">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:weightSum="3"
android:layout_weight="1">
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/btn_caly_swiat"
android:id="@+id/btn_caly_swiat"
android:layout_weight="1" />
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/btn_europa"
android:id="@+id/btn_europa"
android:layout_weight="1" />
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/btn_a_polnocna"
android:id="@+id/btn_a_polnocna"
android:layout_weight="1" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:weightSum="3"
android:layout_weight="1">
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/btn_a_poludniowa"
android:id="@+id/btn_a_poludniowa"
android:layout_weight="1" />
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/btn_afryka"
android:id="@+id/btn_afryka"
android:layout_weight="1" />
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/btn_azja"
android:id="@+id/btn_azja"
android:layout_weight="1" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:weightSum="1"
android:layout_weight="1">
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/btn_australia"
android:id="@+id/btn_australia"
android:layout_weight="1" />
</LinearLayout>
</LinearLayout>
</RelativeLayout>
<RelativeLayout
android:id="@+id/btnWsteczEkranWyboruNauka"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@color/colorButton"
android:paddingBottom="15dp"
android:paddingTop="15dp"
android:gravity="center_horizontal"
android:clickable="true"
android:onClick="wstecz_wybor_nauka"
android:layout_alignParentBottom="true">
<TextView
android:text="@string/txt_btn_wstecz"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/btnWsteczWyborNauka"
android:textSize="25sp"
android:textColor="@color/colorWhite"
/>
</RelativeLayout>
<ImageView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:src="@drawable/border"
android:scaleType="fitXY"/>
</RelativeLayout>