안드로이드 스튜디오 0.4.4상대 레이아웃을 사용하고 중앙
안녕하세요에서 시작하는 목록보기,
를 가진 I 상대 레이아웃 및 가로보기위한 다음과 같은 레이아웃을 가지고있다.
기본적으로 3 개의 EditText와 1 개의 버튼이 있습니다. ListView를 화면 가운데에서 표시하려고합니다. EditText와 Button의 폭을 ListView의 왼쪽에 맞 춥니 다.
나는 dp를 사용하여 이것을 할 수 있었다. 그러나 이것은 다른 화면 밀도에 영향을 미칠 수 있으므로 dp를 사용하는 것을 좋아하지 않습니다.
나는 android:layout_marginLeft="250dp"
에 ListView를 설정 한 다음 글고 치기를 설정하고 버튼 내가 폭으로 DP를 사용하지 않고이 작업을 수행 할 수있는 방법이 있나요 android:layout_width="250dp"
에있다? 다음은 현재 사용중인 XML입니다. 어떤 제안에 대한
많은 감사,
편집 텍스트의 폭에 관해서는<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>
레이아웃을 어떻게 보이게 할 것인지에 대한 스크린 샷이나 그림을 게시하십시오. – SMR