android - Keep view the same on all devices -


how can change activities xml file view stays same regardless of size of screen. mean location in buttons or text is. want stay relatively same distance , everything. how that? relative layout work or there else have in order view same on devices?

xml file:

<?xml version="1.0" encoding="utf-8"?> <android.support.constraint.constraintlayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" tools:context="com.example.navjeevenmann.mytycoon.mainactivity">   <android.support.v7.widget.toolbar     android:id="@+id/toolbar2"     android:layout_width="0dp"     android:layout_height="59dp"     android:background="#2c3aad"     android:minheight="?attr/actionbarsize"     android:theme="?attr/actionbartheme"     app:layout_constraintbottom_tobottomof="parent"     app:layout_constrainthorizontal_bias="1.0"     app:layout_constraintleft_toleftof="parent"     app:layout_constraintright_torightof="parent"     app:layout_constrainttop_totopof="parent"     app:layout_constraintvertical_bias="1.0" />  <textview     android:id="@+id/textview"     android:layout_width="wrap_content"     android:layout_height="wrap_content"     android:layout_marginbottom="8dp"     android:text=""     android:textcolor="#000"     android:textsize="25sp"     app:layout_constraintbottom_tobottomof="parent"     app:layout_constrainthorizontal_bias="0.21"     app:layout_constraintleft_toleftof="parent"     app:layout_constraintright_torightof="parent"     app:layout_constrainttop_totopof="parent"     app:layout_constraintvertical_bias="0.01999998" />   <textview     android:id="@+id/textview2"     android:layout_width="wrap_content"     android:layout_height="wrap_content"     android:text=""     android:textcolor="#000"     android:textsize="25sp"     app:layout_constraintbottom_tobottomof="parent"     app:layout_constrainthorizontal_bias="0.8"     app:layout_constraintleft_toleftof="parent"     app:layout_constraintright_torightof="parent"     app:layout_constrainttop_totopof="parent"     app:layout_constraintvertical_bias="0.02" />  <imagebutton     android:id="@+id/button"     android:layout_width="247dp"     android:layout_height="243dp"     android:background="#0000"     android:src="@drawable/opengraph"     app:layout_constraintbottom_tobottomof="parent"     app:layout_constrainthorizontal_bias="0.503"     app:layout_constraintleft_toleftof="parent"     app:layout_constraintright_torightof="parent"     app:layout_constrainttop_totopof="parent" />  <imagebutton     android:id="@+id/autoclick"     android:layout_width="49dp"     android:layout_height="47dp"     android:src="@drawable/cursor"     app:layout_constraintbottom_tobottomof="parent"     app:layout_constrainthorizontal_bias="0.9"     app:layout_constraintleft_toleftof="parent"     app:layout_constraintright_torightof="parent"     app:layout_constrainttop_totopof="parent"     app:layout_constraintvertical_bias="0.991" />  <imagebutton     android:id="@+id/imageview"     android:layout_width="62dp"     android:layout_height="58dp"     android:adjustviewbounds="true"     android:background="#2c3aad"     android:maxheight="62dp"     android:maxwidth="5dp"     android:scaletype="fitxy"     android:src="@drawable/home"     app:layout_constraintbottom_tobottomof="parent"     app:layout_constraintleft_toleftof="parent"     app:layout_constraintright_torightof="parent"     app:layout_constrainttop_totopof="parent"     app:layout_constraintvertical_bias="1.0" />  <imagebutton     android:id="@+id/singleclick"     android:layout_width="47dp"     android:layout_height="47dp"     android:background="#2c3aad"     android:src="@drawable/singlecursor"     app:layout_constraintbottom_tobottomof="parent"     app:layout_constrainthorizontal_bias="0.1"     app:layout_constraintleft_toleftof="parent"     app:layout_constraintright_torightof="parent"     app:layout_constrainttop_totopof="parent"     app:layout_constraintvertical_bias="0.99" />  <imagebutton     android:id="@+id/imagebutton2"     android:src="@drawable/notes"     android:layout_width="47dp"     android:layout_height="49dp"     android:adjustviewbounds="true"     android:maxheight="62dp"     android:maxwidth="5dp"     android:scaletype="fitxy"     android:background="@null"     app:layout_constraintbottom_tobottomof="parent"     app:layout_constraintleft_toleftof="parent"     app:layout_constraintright_torightof="parent"     app:layout_constrainttop_totopof="parent"     app:layout_constraintvertical_bias="0.0"     app:layout_constrainthorizontal_bias="0.047" />  <textview     android:id="@+id/textview5"     android:layout_width="wrap_content"     android:layout_height="wrap_content"     android:text=""     app:layout_constraintright_torightof="parent"     app:layout_constraintleft_toleftof="parent"     app:layout_constraintbottom_tobottomof="parent"     app:layout_constrainttop_totopof="parent"     app:layout_constraintvertical_bias="0.100000024" /> 

you use layout percentage if want same in other devices. here links use references percentage layout , percent relative layout


Comments

Popular posts from this blog

ubuntu - PHP script to find files of certain extensions in a directory, returns populated array when run in browser, but empty array when run from terminal -

php - How can i create a user dashboard -

javascript - How to detect toggling of the fullscreen-toolbar in jQuery Mobile? -