0

패턴 후 여러 EditTexts 및 TextViews 정렬 EditTexts는 가장 긴 TextView 직후 세로선으로 정렬됩니다.내가 다음과 같이 패션 분야의 한 형태와 같은 승계를 내 앱에서 프로파일 관리 활동을 만들려는

이메일 [email protected]

USERNAME

alexton_mg84 (이 경우 어떤이 "FIRST NAME"것 같다)

FIRST NAME 알렉스

..

CELL + 44 325 23 523

성도 M

..

다음은 현재 보이는 모양의 스 니펫입니다.

enter image description here

그리고이 후 난 행동입니다 :

enter image description here

감사합니다!

당신의 텍스트 뷰와 EditTexts에

답변

0

이 유 내가 볼 수있는 행운

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" 
     android:id="@+id/mainContainer" 
     android:layout_width="fill_parent" 
     android:layout_height="fill_parent" 
     android:background="#000000" 
     android:orientation="vertical" > 

     <LinearLayout 
      android:layout_width="match_parent" 
      android:layout_height="wrap_content" 
      android:layout_margin="10dp" 
      android:background="#ffffff" 
      android:orientation="vertical" > 

      <LinearLayout 
       android:layout_width="fill_parent" 
       android:layout_height="wrap_content" 
       android:layout_weight="2" 
       android:orientation="horizontal" > 

       <TextView 
        android:id="@+id/tvOne" 
        android:layout_width="0dp" 
        android:layout_height="wrap_content" 
        android:layout_weight=".75" 
        android:text="Email" /> 

       <EditText 
        android:id="@+id/tvThree" 
        android:layout_width="0dp" 
        android:layout_height="wrap_content" 
        android:layout_weight="1.25" 
        android:text="Three" /> 
      </LinearLayout> 

      <LinearLayout 
       android:layout_width="fill_parent" 
       android:layout_height="3dp" 
       android:background="#000000" > 
      </LinearLayout> 

      <LinearLayout 
       android:layout_width="fill_parent" 
       android:layout_height="wrap_content" 
       android:layout_weight="2" 
       android:orientation="horizontal" > 

       <TextView 
        android:id="@+id/tvOned" 
        android:layout_width="0dp" 
        android:layout_height="wrap_content" 
        android:layout_weight=".75" 
        android:text="User Name" /> 

       <EditText 
        android:id="@+id/tvThreeda" 
        android:layout_width="0dp" 
        android:layout_height="wrap_content" 
        android:layout_weight="1.25" 
        android:text="Three" /> 
      </LinearLayout> 
     </LinearLayout> 

    </LinearLayout> 
1

사용에 layout_weight 재산 .. 여러 뷰 간의 크기 비율을 지정할 수 있습니다 layout_weight를 가진

. 예 : MapView와지도에 몇 가지 추가 정보가 표시되어야하는 표가 있습니다. 지도는 화면의 3/4을 사용해야하고 표는 화면의 1/4을 사용해야합니다. 그럼 당신은 3지도의에 layout_weight과 1

1

나는 내가에게 반대 방향으로 어떻게 할 것인지 생각에 테이블의 layout_weight를 설정합니다 : android:orientation="horizontal" 에 대한 첫 번째와 LinearLayoutandroid:orientation="vertical"LinearLayout 당신의 TextViews, 두 번째는 EditTexts입니다.

+1

의 : 최선을 원하는대로 전체 코드 친구가 더 필드를 추가, 내가 찾고 있었던 핵심 단어가 있었다 "안드로이드 : layout_width ="0dp ", wrap_content를 사용하고있었습니다. Tyvm! –

0

레이아웃 가중치를 사용해야합니다. 할 수있는 방법> 시도해보십시오.

<LinearLayout 
    android:layout_width="match_parent" 
    android:layout_height="wrap_content" 
    android:weightSum="100" 
    android:orientation="horizontal" > 

    <TextView 
     android:layout_width="0dp" 
     android:layout_weight="40" 
     android:layout_height="wrap_content" 
     android:textSize="20sp" 
     android:text="EMAIL " /> 

    <EditText 
     android:layout_width="0dp" 
     android:layout_weight="60" 
     android:layout_height="wrap_content" 
     android:hint="EMAIL" 
     android:textSize="20sp" /> 
</LinearLayout> 
+0

예, 맞습니다! ty –

관련 문제