Android Studio 0.4.4
Hello,
I have the following layout which is in relative layout and for landscape view.
Basically, I have 3 EditText's and a Button. I want to display the ListView from the centre of the screen. And have the EditText's and Button width's to align to the left of the ListView.
I have managed to do this using the dp. But I don't like using the dp as this could affect other screen densities.
I have set the ListView to android:layout_marginLeft="250dp"
and then set the EditText and button to android:layout_width="250dp"
Is there any way I can do this without using the dp as the width? Here is my current xml.
Many thanks for any suggestions,
<RelativeLayout
android:layout_width="fill_parent"
android:layout_height="fill_parent"
xmlns:android="http://schemas.android.com/apk/res/android">
<ListView
android:id="@+id/lvFriends"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:scrollbars="vertical"
android:layout_marginLeft="250dp">
</ListView>
<EditText
android:id="@+id/etName"
android:layout_width="250dp"
android:layout_height="wrap_content"
android:hint="Name"
android:textSize="22sp"
android:inputType="text"/>
<EditText
android:id="@+id/etPhone"
android:layout_width="250dp"
android:layout_height="wrap_content"
android:hint="Phone"
android:textSize="22sp"
android:inputType="phone"
android:layout_below="@+id/etName"/>
<EditText
android:id="@+id/etEmail"
android:layout_width="250dp"
android:layout_height="wrap_content"
android:hint="Email"
android:textSize="22sp"
android:inputType="textEmailAddress"
android:layout_below="@+id/etPhone"/>
<Button
android:id="@+id/btnAddFriend"
android:layout_width="250dp"
android:layout_height="wrap_content"
android:text="Add Friend"
android:textSize="22sp"
android:layout_marginTop="8dp"
android:layout_below="@+id/etEmail"/>
</RelativeLayout>