xiaoyan_12 2013-04-03 09:14 采纳率: 25%
浏览 2365

ImageButton的顶部显示不像Button和EditText那样对齐

在 layout.xml 中设置:

<EditText android:id="@+id/body" android:layout_width="wrap_content"
            android:layout_height="wrap_content" android:layout_weight="1"
            android:hint="Type to compose" />
        <ImageButton android:id="@+id/attach"
            android:layout_width="wrap_content" android:layout_height="wrap_content"
            android:src="@drawable/attach_photo" />
        <Button android:id="@+id/send" android:text="@string/send"
            android:layout_width="wrap_content" android:layout_height="wrap_content" />
    </LinearLayout>

现在遇到的问题是:ImageButton 的顶部显示不像 Button 和 EditText 那样。Button 和EditText 上的内容显示的时候,上下填充的很好。但是,ImageButton 上面的内容似乎向上突出了。如何设置按钮的显示呢?

  • 写回答

1条回答 默认 最新

  • Baby_Bonnie 2013-04-07 02:11
    关注

    使用一个 RelativeLayout。你可以把视图向两边对齐,父类的顶端和底部或者别的视图。
    使用android:layout_alignParentTop="true"
    在 RelativeLayout 中有大量的 xml 命令。

    评论

报告相同问题?

悬赏问题

  • ¥88 找成都本地经验丰富懂小程序开发的技术大咖
  • ¥15 如何处理复杂数据表格的除法运算
  • ¥15 如何用stc8h1k08的片子做485数据透传的功能?(关键词-串口)
  • ¥15 有兄弟姐妹会用word插图功能制作类似citespace的图片吗?
  • ¥200 uniapp长期运行卡死问题解决
  • ¥15 请教:如何用postman调用本地虚拟机区块链接上的合约?
  • ¥15 为什么使用javacv转封装rtsp为rtmp时出现如下问题:[h264 @ 000000004faf7500]no frame?
  • ¥15 乘性高斯噪声在深度学习网络中的应用
  • ¥15 关于docker部署flink集成hadoop的yarn,请教个问题 flink启动yarn-session.sh连不上hadoop,这个整了好几天一直不行,求帮忙看一下怎么解决
  • ¥15 深度学习根据CNN网络模型,搭建BP模型并训练MNIST数据集