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 命令。

    评论

报告相同问题?

悬赏问题

  • ¥15 如何在scanpy上做差异基因和通路富集?
  • ¥20 关于#硬件工程#的问题,请各位专家解答!
  • ¥15 关于#matlab#的问题:期望的系统闭环传递函数为G(s)=wn^2/s^2+2¢wn+wn^2阻尼系数¢=0.707,使系统具有较小的超调量
  • ¥15 FLUENT如何实现在堆积颗粒的上表面加载高斯热源
  • ¥30 截图中的mathematics程序转换成matlab
  • ¥15 动力学代码报错,维度不匹配
  • ¥15 Power query添加列问题
  • ¥50 Kubernetes&Fission&Eleasticsearch
  • ¥15 報錯:Person is not mapped,如何解決?
  • ¥15 c++头文件不能识别CDialog