LinearLayout 中项目的位置

发布于 2024-12-17 04:18:21 字数 88 浏览 4 评论 0原文

如何设计一个带有两个相邻按钮(水平)的 Android 应用程序,并且在这些按钮下方我有一个使用 LinearLayout 的文本视图(垂直)?无法让它发挥作用。

How do I design an android application with two buttons next to each other (horizontal) and below these buttons i have a textview (vertical) using LinearLayout? Can't get it to work.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

咆哮 2024-12-24 04:18:21
<LinearLayout android:layout_width="fill_parent"
    android:layout_height="wrap_content" android:orientation="horizontal">
    <Button android:layout_width="wrap_content"
        android:layout_height="wrap_content" />
    <Button android:layout_width="wrap_content"
        android:layout_height="wrap_content" />
</LinearLayout>
<TextView android:layout_width="fill_parent"
    android:layout_height="wrap_content" />

<LinearLayout android:layout_width="fill_parent"
    android:layout_height="wrap_content" android:orientation="horizontal">
    <Button android:layout_width="wrap_content"
        android:layout_height="wrap_content" />
    <Button android:layout_width="wrap_content"
        android:layout_height="wrap_content" />
</LinearLayout>
<TextView android:layout_width="fill_parent"
    android:layout_height="wrap_content" />

最丧也最甜 2024-12-24 04:18:21

在这种情况下,使用relativelayout要好得多。您刚刚根据您相对于彼此的视图项目描述了您想要的结果。它的使用比您想象的要简单。

http://developer.android.com/resources/tutorials/views/hello -relativelayout.html

Far better to use the RelativeLayout in this case. You just described your desired result in terms of the items of your view relative to one another. It is simpler to use than you might think.

http://developer.android.com/resources/tutorials/views/hello-relativelayout.html

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文