I'm a budding android developer, I'm creating an android app which contains a dashboard. I designed my dashboard according to my NEXUS 7 tablet. Now when I run that same app in a 5 inch android phone all the alignments where disoriented. Is there any solution? so that it will look's the same in all screen sizes. Below is my code
<RelativeLayout xmlns:android="http://ift.tt/nIICcg"
xmlns:tools="http://ift.tt/LrGmb4"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".MainActivity"
android:background="#ffffffff">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:weightSum="2"
android:layout_marginTop="20dp"
android:layout_marginRight="20dp"
android:layout_marginLeft="20dp"
android:layout_marginBottom="20dp"
android:orientation="vertical"
>
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="0.0dp"
android:layout_weight="1">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="SpO2"
android:textSize="100dp"
android:layout_centerHorizontal="true"
android:id="@+id/four_five"
android:layout_marginTop="20dp"
android:textColor="#ff7a0000" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="45% "
android:textSize="100dp"
android:layout_alignParentRight="true"
android:layout_below="@+id/four_five"
android:textColor="#ffef00b9" />
<ImageButton
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginBottom="10dp"
android:background="@drawable/spo2"/>
</RelativeLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="0.0dp"
android:layout_weight="1"
android:weightSum="3"
android:layout_marginTop="10dp"
>
<RelativeLayout
android:layout_width="0.0dp"
android:layout_height="match_parent"
android:layout_weight="1"
android:layout_marginRight="5dp">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="70dp"
android:text="STEPS"
android:layout_centerHorizontal="true"
android:textSize="50dp"
android:id="@+id/text_view3"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@+id/text_view3"
android:id="@+id/text_view4"
android:layout_alignParentRight="true"
android:text="1258"
android:layout_marginRight="10dp"
android:textSize="40dp"/>
<ImageButton
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@drawable/steps"/>
</RelativeLayout>
<RelativeLayout
android:layout_width="0.0dp"
android:layout_height="match_parent"
android:layout_weight="1"
android:layout_marginLeft="5dp"
android:layout_marginRight="5dp"
>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/text_view5"
android:text="bpm"
android:textSize="50dp"
android:layout_centerInParent="true"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/text_view6"
android:layout_below="@+id/text_view5"
android:text="5000"
android:textSize="60dp"
android:layout_centerHorizontal="true"/>
<ImageButton
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@drawable/bpm"
/>
</RelativeLayout>
<RelativeLayout
android:layout_width="0.0dp"
android:layout_height="match_parent"
android:layout_weight="1"
android:layout_marginLeft="5dp">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="KCal"
android:id="@+id/text_view7"
android:textSize="50dp"
android:layout_marginTop="70dp"
android:layout_centerHorizontal="true"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/text_view8"
android:text="9876"
android:layout_marginRight="10dp"
android:layout_below="@+id/text_view7"
android:textSize="40dp"
android:layout_alignParentLeft="true"/>
<ImageButton
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@drawable/kcal"/>
</RelativeLayout>
</LinearLayout>
</LinearLayout>
<ImageView
android:layout_width="250dp"
android:layout_height="250dp"
android:layout_centerInParent="true"
android:id="@+id/image_view"
android:background="@drawable/centre_button"/>
<ImageButton
android:layout_width="200dp"
android:layout_height="200dp"
android:layout_centerInParent="true"
android:background="@drawable/main_centre_button"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:layout_centerVertical="true"
android:text="99°C"
android:textSize="50dp"
android:id="@+id/text_view9"/>
Aucun commentaire:
Enregistrer un commentaire