lundi 11 mai 2015

Button's style is adding unknown attribute - Android

I am trying to achieve the look of Facebook's event page and am having trouble copying their three buttons that say if a person is going to an event.

I am trying to achieve this,

enter image description here

Mine currently looks like this,

enter image description here

This is the XML for the buttons

    <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>

I do not know where the extra Padding or Margin is coming from above and below my buttons. I have tried android:padding="0dp" and android:layout_margin="0dp" on the buttons but it had no effect.

My best guess is it might have something to do with the layout_weight attribute. This may give the buttons a certain height based on their width, if this is the case then how can I make the buttons shorter?

Aucun commentaire:

Enregistrer un commentaire