android - How to place UI components uniformly using dip -


i need make below ui android app.

specifications:

  1. ui contains total 4 sections (1-4).

  2. component 1,2 & 4 must of same size.

  3. component 3 must twice size of component 1.

enter image description here

but how can calculate exact dip size component uniformly sized on different sized screens?

if approach wrong please advice.

thank you

if approach wrong please advice.

use vertical linearlayout , android:layout_weight on children. if pretend moment children buttons, use:

<?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="match_parent" android:orientation="vertical">  <button android:layout_width="match_parent" android:layout_height="0dip" android:layout_weight="1" android:text="1"/>  <button android:layout_width="match_parent" android:layout_height="0dip" android:layout_weight="2" android:text="2"/>  <button android:layout_width="match_parent" android:layout_height="0dip" android:layout_weight="1" android:text="3"/>  <button android:layout_width="match_parent" android:layout_height="0dip" android:layout_weight="1" android:text="4"/>  </linearlayout> 

the result is:

screenshot of layout


Comments

Popular posts from this blog

java.util.scanner - How to read and add only numbers to array from a text file -

rewrite - Trouble with Wordpress multiple custom querystrings -