开发者社区 问答 正文

如何创建android按钮栏?

我需要创建一个水平按钮列表,没有一个像这样的空格。 每个按钮将包含一个文本和一个我知道的关于按钮栏布局的图标,但是它对我不起作用,请有人帮帮我,谢谢

展开
收起
游客ufivfoddcd53c 2020-01-04 17:02:03 1102 分享 版权
1 条回答
写回答
取消 提交回答
  • <LinearLayout 
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:orientation="horizontal">
    
        <Button
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_weight="1"
            android:drawableTop="@drawable/read"
            android:text="Rewards" />
    
        <Button
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_weight="1"
            android:drawableTop="@drawable/read"
            android:text="Places" />
    
        <Button
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_weight="1"
            android:drawableTop="@drawable/read"
            android:text="Challenges" />
    </LinearLayout>
    
    

    将LinearLayout与水平方向配合使用,并将三个按钮与layout_weight = 1配合使用

    2020-01-04 17:02:20
    赞同 展开评论
问答分类:
问答地址: