테이블 행이 7 개 있습니다.linearview 안에 textViews를 가운데에 배치하는 방법은 무엇입니까?
모든 행을 4 개로 균일하게 분할하고 각 섹션에 숫자를 쓰고 싶습니다. 그래서 행 내부에 linearLayout을 삽입하고 선형 레이아웃 내부에 4 개의 textView를 추가합니다. 이 tableRow의
코드는 다음과 같습니다 나는 중력의 다른 변종을 시도하지만, 그들 모두가 숫자를 중심하지 않는
<TableRow
android:id="@+id/tableRow2"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="fill"
android:layout_weight="1"
android:gravity="fill_horizontal" >
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="right"
android:layout_weight="1" >
<TextView
android:id="@+id/textView1"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="1"
android:textColor="@color/line_true"
android:textSize="50dp" />
<TextView
android:id="@+id/textView2"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_weight="1"
android:text="1"
android:textColor="@color/line_true"
android:textSize="50dp" />
<TextView
android:id="@+id/textView3"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_weight="1"
android:text="1"
android:textColor="@color/line_true"
android:textSize="50dp" />
<TextView
android:id="@+id/textView4"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_weight="1"
android:text="1"
android:textColor="@color/line_true"
android:textSize="50dp" />
</LinearLayout>
</TableRow>
! 숫자는 왼쪽에 더 가깝게 보입니다. 이 문제를 설정하는 방법
(단지 큰 숫자 1,2,3,4에 맞춰 보면 ) :
그것은 다음과 같습니다?
좋은 예, 당신은 당신이 일을 얻기 위해 무엇을했는지 영업을 얘기해야하지만 : 안드로이드 : weightSum = "4"가있는 LinearLayout 내의 구성 요소를 추가하기 위해 가중치가 필요하다고 지정 4. android : layout_weight = "1"로 설정하면 각각 동일한 간격이 부여됩니다. –