행이 채워진 ListView가 있습니다.LinearLayout layout_weight
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="horizontal"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:paddingLeft="8dip"
android:weightSum="100">
<TextView
android:layout_width="0dp"
android:layout_height="wrap_content"
android:id="@+id/columnA"
android:layout_weight="30"
android:layout_gravity="center"/>
<TextView
android:layout_width="0dp"
android:layout_height="wrap_content"
android:id="@+id/columnB"
android:layout_weight="30"
android:layout_gravity="center"/>
<ImageView
android:layout_width="0dp"
android:layout_height="wrap_content"
android:src="@drawable/icon"
android:id="@+id/columnC"
android:layout_weight="10"
android:layout_gravity="center"
>
</ImageView>
<CheckBox
android:layout_width="0dp"
android:layout_height="wrap_content"
android:id="@+id/columnD"
android:layout_weight="30"
android:layout_gravity="center"/>
문제는 내 행이 동일하게 세에서 간격되도록 내가의 columnC 항목 및 COLUMNB 항목이 서로 매우 가까이 할 것입니다 :처럼이 행이 보이는 XML 파일에서 온 부품, 즉 : columnA, (columnB + columnC) 그리고 columnD. 내가 볼 수 있듯이 layout_weight를 사용하여이 작업을 수행하려고 시도했지만 위의 코드는 반대의 효과가있는 것 같습니다. columnA와 columnB는 왼쪽에서 매우 부각되며, C 열은 자체적으로 큰 공간에서 떠 다니는 것처럼 보입니다. 그런 다음 columnD는 columnC 근처에 위치하며 오른쪽에 너무 많은 공간이 있습니다. 내가 도대체 뭘 잘못하고있는 겁니까? : s
그것에 나를 이길 그들을 동등하게 만들려고 노력하지 않아도 내가 게시하기 전에. – Maximus
두 분 모두 덕분에 분명히 좋아 보이지만 columnD는 여전히 오른쪽에 너무 많은 공간이있는 columnC에 너무 가까이에 나타납니다. ■ 체크 박스와 관련이 있습니다. –
괜찮아요 -이 나머지 문제를 해결하기 위해 linearlayout에서 내 체크 박스를 감싸고 선형 레이아웃에서 무게와 중력을 설정해야합니다. 고마워! –