A
A
Artyom Artyomov2014-07-06 02:08:42
Java
Artyom Artyomov, 2014-07-06 02:08:42

How to put two editTexts in the middle so they look the same on all android screens?

I can’t find a suitable solution. It looks great on android 4+, but everything floats on 2.3 on the phone and in Chinese. I draw on canvas. There is a problem with two edittexts. Here is the xml code

<?xml version="1.0" encoding="utf-8"?>
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent" >

    <com.andraft.views.PhaseOne
        android:id="@+id/first"
        android:layout_width="match_parent"
        android:layout_height="match_parent" />

    <RelativeLayout
        android:id="@+id/contentka"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:gravity="center" >

        <EditText
            android:id="@+id/latEdit"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_centerHorizontal="true"
            android:layout_centerVertical="true"
            android:ems="10"
            android:hint="Широта"
            android:inputType="numberDecimal" />

        <EditText
            android:id="@+id/lonEdit"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_marginTop="30px"
            android:layout_centerHorizontal="true"
            android:layout_below="@id/latEdit"
            android:ems="10"
            android:hint="Долгота"
            android:inputType="numberDecimal" />
    </RelativeLayout>
</FrameLayout>

Answer the question

In order to leave comments, you need to log in

1 answer(s)
V
Vladimir Abramov, 2014-07-06
@kivsiak

It is not necessary to set font sizes in px only in dp
developer.android.com/guide/practices/screens_supp...
It is also better to set font sizes in fontSize and in sp

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question