Pergunta

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>
Foi útil?

Solução

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">

Outras dicas

you have to use

  android:orientation="vertical"

instead of

android:orientation="horizontal"
Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top