首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >放置项目布局,未显示buttonBar

放置项目布局,未显示buttonBar
EN

Stack Overflow用户
提问于 2016-08-20 15:18:25
回答 1查看 43关注 0票数 0

我对标记布局有一些问题,我没有显示buttonBar,尽管它在代码xml中。请帮我解决问题。

这是我的代码:

代码语言:javascript
复制
<ImageView
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:id="@+id/imageQuote"
    android:layout_marginTop="10dp"
    android:layout_centerHorizontal="true" />


<TextView
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:textAppearance="?android:attr/textAppearanceMedium"
    android:text="Description"
    android:id="@+id/descriptionOfQuote"
    android:layout_below="@+id/imageQuote"
    android:layout_marginTop="10dp"
    android:layout_centerHorizontal="true"
    android:foregroundGravity="center"
    android:textSize="22dp"/>

<LinearLayout
    android:id="@+id/buttonBar"
    android:layout_marginBottom="1dp"
    android:layout_width="fill_parent"
    android:layout_height="wrap_content"
    android:layout_alignParentBottom="true"
    android:foregroundGravity="center"
    android:gravity="bottom"
    >
    <ImageButton
        android:layout_width="85dp"
        android:layout_height="match_parent"
        android:id="@+id/arrow_left"
        android:src="@drawable/arrow_left"
        android:background="?android:selectableItemBackground"/>
    <ImageButton
        android:layout_width="85dp"
        android:layout_height="match_parent"
        android:id="@+id/btn_copy"
        android:src="@drawable/copy"
        android:background="?android:selectableItemBackground"/>

    <ImageButton
        android:layout_width="85dp"
        android:layout_height="match_parent"
        android:id="@+id/btn_share"
        android:src="@drawable/share"
        android:background="?android:selectableItemBackground"/>

    <ImageButton
        android:layout_width="85dp"
        android:layout_height="match_parent"
        android:id="@+id/arrow_right"
        android:src="@drawable/arrow_right"
        android:background="?android:selectableItemBackground"/>

</LinearLayout>

enter image description here

如何让buttonBar显示在屏幕的底部?

EN

回答 1

Stack Overflow用户

发布于 2016-08-20 16:28:59

我有两个线索可以解决你的问题:

1)使LinearLayout方向为水平方向:

代码语言:javascript
复制
<LinearLayout
android:id="@+id/buttonBar"
android:layout_marginBottom="1dp"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:foregroundGravity="center"
android:gravity="bottom"
android:orientation="horizontal"
>

2)我不确定,但buttonBar的孩子的高度可能有问题,尝试将其设置为宽度:

代码语言:javascript
复制
<ImageButton
    android:layout_width="85dp"
    android:layout_height="85dp"
    android:id="@+id/arrow_left"
    android:src="@drawable/arrow_left"
    android:background="?android:selectableItemBackground"/>

我实际上没有Android Studio来检查我的答案是否正确,很抱歉:(

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/39051585

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档