我想实现Facebook的事件页面的外观,并且无法复制他们的三个按钮,说如果一个人要去一个事件。按钮的风格是添加未知属性 - Android
我试图做到这一点,
矿目前看起来是这样的,
这是按钮
<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>
我的XML不知道在哪里额外Padding
或Margin
来自我的按钮上方和下方。我试过按钮上的android:padding="0dp"
和android:layout_margin="0dp"
,但它没有效果。
我最好猜测的是它可能与layout_weight
属性有关。这可能会使按钮的宽度有一定的高度,如果是这种情况,那我该如何缩短按钮?
而不是将layout_width设置为wrap_content给它一个特定的高度,然后你将实现你想要的效果 –
尝试使用ImageButton并设置背景:android:src =“” – George
按钮有'android:minHeight = 48dp'和'android:minWidth = 88dp'(on棒糖)。这包括任何填充。 –