Button的风格是添加未知属性 – Android

我试图实现Facebook的活动页面的外观,并且我在复制他们的三个按钮时遇到问题,这些按钮说明一个人是否要参加活动.

我想要实现这一点,

我的目前看起来像这样,

这是按钮的XML

<LinearLayout
        android:id="@+id/button_holder"
        android:layout_alignParentBottom="true"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:orientation="horizontal"
        android:weightSum="3"
        android:layout_marginLeft="10dp"
        android:layout_marginStart="10dp"
        android:paddingBottom="10dp">

        <Button
            android:id="@+id/button_going"
            android:layout_width="0dp"
            android:layout_weight="1"
            android:layout_height="wrap_content"
            android:layout_gravity="center"
            android:textSize="14sp"
            android:textColor="@color/secondary_text"
            android:text="Going"
            android:background="@drawable/item_left_button_background"/>

        <Button
            android:id="@+id/button_maybe"
            android:layout_width="0dp"
            android:layout_weight="1"
            android:layout_height="wrap_content"
            android:layout_gravity="center"
            android:textSize="14sp"
            android:textColor="@color/secondary_text"
            android:text="Maybe"
            android:background="@drawable/item_middle_button_background"/>

        <Button
            android:id="@+id/button_decline"
            android:layout_width="0dp"
            android:layout_weight="1"
            android:layout_height="wrap_content"
            android:layout_gravity="center"
            android:textSize="14sp"
            android:textColor="@color/secondary_text"
            android:text="Decline"
            android:background="@drawable/item_right_button_background"/>

    </LinearLayout>

我不知道在我的按钮上方和下方有多余的填充或边距.我在按钮上尝试了android:padding =“0dp”和android:layout_margin =“0dp”,但它没有效果.

我最好的猜测是它可能与layout_weight属性有关.这可能会根据宽度给按钮一定的高度,如果是这种情况,那么如何缩短按钮呢?

解决方法

当您应用背景item_left_button_background时,必须是包含图像的图像或选择器,这些图像具有特定高度.当您将按钮高度设置为wrap_content时,认情况下将采用图像的高度,以便根据我的建议为按钮指定特定高度或根据您所需的尺寸创建背景图像

相关文章

Android性能优化——之控件的优化 前面讲了图像的优化,接下...
前言 上一篇已经讲了如何实现textView中粗字体效果,里面主要...
最近项目重构,涉及到了数据库和文件下载,发现GreenDao这个...
WebView加载页面的两种方式 一、加载网络页面 加载网络页面,...
给APP全局设置字体主要分为两个方面来介绍 一、给原生界面设...
前言 最近UI大牛出了一版新的效果图,按照IOS的效果做的,页...