How to build UI that support all screen sizes and devices in android -


i'm trying develop android application i've been stuck while trying scale views in activity.

in picture can see resolution-width 10px(it's make more understandable guys) @ both devices. size of screens differentiate 5 inch 10 inch. blue rectangle edittext want scale on different devices.

so can see, edittext in both devices have same sizes different amount of pixels. want both devices same , have tried fix nothing seems work out me.

(this example image draw show problem, second image try make , goes wrong)

enter image description here

this i'm trying fixed:

enter image description here

basically this, should work :

<?xml version="1.0" encoding="utf-8"?> <linearlayout xmlns:android="http://schemas.android.com/apk/res/android"     android:layout_width="match_parent"     android:layout_height="wrap_content"     android:orientation="vertical"     android:weightsum="100">      <textview         android:layout_width="match_parent"         android:layout_height="0dp"         android:layout_weight="5" />      <edittext         android:layout_width="match_parent"         android:layout_height="0dp"         android:layout_weight="10" />      <textview         android:layout_width="match_parent"         android:layout_height="0dp"         android:layout_weight="5" />      <edittext         android:layout_width="match_parent"         android:layout_height="0dp"         android:layout_weight="10" />      <textview         android:layout_width="match_parent"         android:layout_height="0dp"         android:layout_weight="5" />      <linearlayout         android:layout_width="match_parent"         android:layout_height="0dp"         android:layout_weight="10"         android:orientation="horizontal"         android:weightsum="100">          <textview             android:layout_width="0dp"             android:layout_height="wrap_content"             android:layout_weight="10" />          <textview             android:layout_width="0dp"             android:layout_height="wrap_content"             android:layout_weight="10" />          <textview             android:layout_width="0dp"             android:layout_height="wrap_content"             android:layout_weight="10" />      </linearlayout>      <textview         android:layout_width="match_parent"         android:layout_height="0dp"         android:layout_weight="5" />      <edittext         android:layout_width="match_parent"         android:layout_height="0dp"         android:layout_weight="10" />      <textview         android:layout_width="match_parent"         android:layout_height="0dp"         android:layout_weight="5" />      <edittext         android:layout_width="match_parent"         android:layout_height="0dp"         android:layout_weight="10" />  </linearlayout> 

Comments

Popular posts from this blog

node.js - Node js - Trying to send POST request, but it is not loading javascript content -

javascript - Replicate keyboard event with html button -

javascript - Web audio api 5.1 surround example not working in firefox -