【发布时间】:2015-01-07 07:50:03
【问题描述】:
我是 android 开发的初学者,如果我的问题需要解决,非常抱歉。我试图在互联网上搜索,但没有什么好用的。
我试图创建一个像这样的视图:
我可以使用 RelativeLayout 或至少使用 GridView 成功吗? 最好的祝福, Zed13
【问题讨论】:
标签: android height width imagebutton
我是 android 开发的初学者,如果我的问题需要解决,非常抱歉。我试图在互联网上搜索,但没有什么好用的。
我试图创建一个像这样的视图:
我可以使用 RelativeLayout 或至少使用 GridView 成功吗? 最好的祝福, Zed13
【问题讨论】:
标签: android height width imagebutton
使用带有 weightsum 3 的 Linearlayout 并放置三个高度为 1 的视图,这就是您想要的视图。如下所示,而不是按钮使用您想要的视图、布局等,它们完全分开。
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#fff"
android:orientation="vertical"
android:weightSum="3" >
<Button
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1"
android:background="#f7f0db" />
<Button
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1"
android:background="#17f0db" />
<Button
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1"
android:background="#89f1db" />
</LinearLayout>
【讨论】: