Estou com dificuldades para montar um layout.
No emulado ele fica da forma como quero conforme abaixo:
Porém no celular fica completamente desconfigurado conforme abaixo:
Código XML:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical"
android:id="@+id/lnl_principal"
android:background="#ffe7fcff"
android:weightSum="1">
<LinearLayout
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="185pt"
android:gravity="center"
android:id="@+id/lnl_periodo">
<LinearLayout
android:orientation="vertical"
android:layout_width="155pt"
android:layout_height="27pt"
android:id="@+id/lnl_ftp"
android:gravity="center">
<TextView
android:layout_width="150pt"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceSmall"
android:id="@+id/txt_hintftp"
android:text="@string/lbl_hintftp" />
<EditText
android:layout_width="155pt"
android:layout_height="wrap_content"
android:id="@+id/edt_ftp"
android:layout_gravity="center_horizontal"
android:inputType="text"
android:textColor="#010101"
android:singleLine="true"
android:editable="false" />
</LinearLayout>
<LinearLayout
android:orientation="vertical"
android:layout_width="155pt"
android:layout_height="27pt"
android:id="@+id/lnl_porta"
android:focusableInTouchMode="true"
android:gravity="center"
android:weightSum="1">
<TextView
android:layout_width="150pt"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceSmall"
android:id="@+id/txt_hintport"
android:text="@string/lbl_hintport" />
<EditText
android:layout_width="155pt"
android:layout_height="match_parent"
android:id="@+id/edt_portnumber"
android:layout_gravity="center_horizontal"
android:inputType="text"
android:textColor="#010101"
android:layout_weight="0.67" />
</LinearLayout>
<LinearLayout
android:orientation="vertical"
android:layout_width="155pt"
android:layout_height="27pt"
android:id="@+id/lnl_pasta"
android:gravity="center">
<TextView
android:layout_width="150pt"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceSmall"
android:id="@+id/txt_hintdir"
android:text="@string/lbl_hintdir" />
<EditText
android:layout_width="155pt"
android:layout_height="match_parent"
android:id="@+id/edt_diretorio"
android:layout_gravity="center_horizontal"
android:inputType="text"
android:textColor="#010101"
android:gravity="center|left" />
</LinearLayout>
<LinearLayout
android:orientation="vertical"
android:layout_width="155pt"
android:layout_height="27pt"
android:id="@+id/lnl_usuario"
android:gravity="center">
<TextView
android:layout_width="150pt"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceSmall"
android:id="@+id/txt_hintuser"
android:text="@string/lbl_hintuser" />
<EditText
android:layout_width="155pt"
android:layout_height="match_parent"
android:id="@+id/edt_usuario"
android:layout_gravity="center_horizontal"
android:inputType="text"
android:textColor="#010101"
android:gravity="center|left" />
</LinearLayout>
<LinearLayout
android:orientation="vertical"
android:layout_width="155pt"
android:layout_height="27pt"
android:layout_gravity="center_horizontal"
android:id="@+id/lnl_senha"
android:gravity="center">
<TextView
android:layout_width="150pt"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceSmall"
android:id="@+id/txt_hintpass"
android:text="@string/lbl_hintpass" />
<EditText
android:layout_width="155pt"
android:layout_height="match_parent"
android:id="@+id/edt_senha"
android:layout_gravity="center_horizontal"
android:inputType="textPassword"
android:textColor="#010101"
android:gravity="center|left" />
</LinearLayout>
<LinearLayout
android:orientation="horizontal"
android:layout_width="155pt"
android:layout_height="25pt"
android:id="@+id/lnl_excluir"
android:gravity="center">
<LinearLayout
android:orientation="vertical"
android:layout_width="76pt"
android:layout_height="match_parent"
android:id="@+id/lnl_delete"
android:gravity="center">
<TextView
android:layout_width="73pt"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceSmall"
android:id="@+id/txt_hintdel"
android:text="@string/lbl_hintdel" />
<Spinner
android:layout_width="match_parent"
android:layout_height="0dp"
android:id="@+id/spn_excluir"
android:layout_weight="1"
android:gravity="left|top" />
</LinearLayout>
<LinearLayout
android:orientation="vertical"
android:layout_width="76pt"
android:layout_height="match_parent"
android:id="@+id/lnl_tiponet"
android:gravity="center">
<TextView
android:layout_width="73pt"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceSmall"
android:id="@+id/txt_hintup"
android:text="@string/lbl_hintup" />
<Spinner
android:layout_width="match_parent"
android:layout_height="0dp"
android:id="@+id/spn_tiponet"
android:layout_weight="1"
android:gravity="left|top" />
</LinearLayout>
</LinearLayout>
</LinearLayout>
<LinearLayout
android:orientation="horizontal"
android:layout_width="match_parent"
android:layout_height="45pt"
android:id="@+id/lnl_botoes"
android:gravity="center">
<ImageButton
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/btn_cancelar"
android:nestedScrollingEnabled="false"
android:src="@mipmap/cancela"
android:contentDescription="btn_cancelar"
android:background="#ffe7fcff" />
<LinearLayout
android:orientation="horizontal"
android:layout_width="20dp"
android:layout_height="match_parent"
android:id="@+id/lnl_espbtn"></LinearLayout>
<ImageButton
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/btn_testar"
android:src="@mipmap/testar"
android:contentDescription="btn_testar"
android:background="#ffe7fcff" />
<LinearLayout
android:orientation="horizontal"
android:layout_width="20dp"
android:layout_height="match_parent"
android:id="@+id/lnl_espbtn2" />
<ImageButton
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/btn_confirmar"
android:src="@mipmap/confirma"
android:contentDescription="btn_confirmar"
android:background="#ffe7fcff" />
</LinearLayout>
</LinearLayout>
Estou usando LinearLayout
em todos os layouts.
O celular obviamente possui uma resolução diferente, mas qual a melhor forma de fazer com que o layout seja usual para qualquer equipamento em telas com resolução diferente?
fill_parent
para width e height do layout pai? Tenta trocar paramatch_parent
e rodar.