开发者社区> 问答> 正文

如何创建android按钮栏?

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

展开
收起
游客ufivfoddcd53c 2020-01-04 17:02:03 1087 0
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
    赞同 展开评论 打赏
问答分类:
问答地址:
问答排行榜
最热
最新

相关电子书

更多
58同城Android客户端Walle框架演进与实践之路 立即下载
Android组件化实现 立即下载
蚂蚁聚宝Android秒级编译——Freeline 立即下载