테이블 레이아웃의 최상위 행에는 layout_weight를 사용하여 3 개의 동등하게 분산 된 버튼이 있도록이 인터페이스를 만들었습니다. (내 생각이 길고 무관 한 이후Android Layout_ TableLayout에서 제대로 작동하지 않습니까?
이 <RelativeLayout
android:id="@+id/content_rel"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#ECECEC"
android:orientation="vertical" >
<LinearLayout
android:id="@+id/blurImage"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical" >
<TableLayout
android:id="@+id/tableLayout1"
android:layout_width="match_parent"
android:layout_height="match_parent" >
<TableRow
android:id="@+id/tableRow1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:padding="5dip" >
<ImageButton
android:id="@+id/btnHeartLike"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:clickable="true"
android:src="@drawable/selector" />
<ImageButton
android:id="@+id/btnShare"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:clickable="true"
android:src="@drawable/share39" />
<ImageButton
android:id="@+id/btnProductComment"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:clickable="true"
android:src="@drawable/comment_icon" />
</TableRow>
나는 코드의 나머지 부분을 추가하지 않은 :
그리고 이것은 내 코드입니다 :하지만이 내가 끝낼 무엇인가?). 나머지도 필요하면 알려주세요.하지만 문제는 레이아웃에 있다고 생각합니까? 뭐가 잘못됐다고 생각하니?
상대 레이아웃에는 방향이 필요하지 않습니다. 선형 레이아웃 만 수직 또는 수평을 정의해야합니다. 또한 당신은 단지 3 개의 이미지 버튼을 사용하고 있기 때문에 왜 테이블 레이아웃을 사용하고 수평 선형 레이아웃을 사용하지 않고 layout_width = 1로 만들면 원하는 효과를 얻을 수 있습니다. –
테이블 레이아웃을 사용하지 않으면 이미지 버튼이 도처에서 벗어 났고 완벽한 행이 아니라 내가 stackoverflow에 게시하지 않은 행이 더 많습니다. 내 선형 레이아웃을 수평으로 만드시겠습니까? 왜냐하면 저는 이미 수직 선형 레이아웃을 가지고 있습니다. @KostasMatrix –
예. 아래 @ kamran 대답을보고 그의 대답에 가로 방향을 추가하십시오 –