簡體   English   中英

如何在線性布局中對齊textview下方的按鈕

[英]How to align buttons below textview in linear 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>

您是否嘗試將頂部LinearLayout的方向更改為vertical 像這樣的東西。

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

你必須使用

  android:orientation="vertical"

代替

android:orientation="horizontal"

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM