문제

I have a table and for each cell I have text and three buttons.

I want the buttons to be aligned right below the text view but I can't get them to align like that.

This is my layout:

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:orientation="horizontal"
    android:descendantFocusability="blocksDescendants">

    <TextView
        android:id="@+id/name"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:paddingBottom="15dip"
        android:paddingLeft="5dip"
        android:textStyle="bold"
        android:paddingTop="5dip"
        android:textColor="#000000"
        android:textSize="16dip"
        android:layout_toRightOf="@+id/track_no"/>

    <LinearLayout
        android:id="@+id/c1"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:orientation="horizontal">

        <ImageButton ../>

        <ImageButton ../>

        <ImageButton ../>
    </LinearLayout>
</LinearLayout>
도움이 되었습니까?

해결책

Have you tried changing your top LinearLayout's orientation to vertical ? Something like this.

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:orientation="vertical"
    android:descendantFocusability="blocksDescendants">

다른 팁

you have to use

  android:orientation="vertical"

instead of

android:orientation="horizontal"
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top