Issue
Iam designing a food ordering page, so i need to use small button to add the food on cart.The problem was when i giving 24dp width and height the button size reduces but i cant able to add the text("+" "-").
I have tried
android:minWidth="0dp"
android:minHeight="0dp"
style="?android:attr/negativeButtonText"
<android.support.design.button.MaterialButton
android:id="@+id/incrementButtton"
style="?android:attr/buttonStyleSmall"
android:layout_width="24dp"
android:layout_height="24dp"
android:layout_gravity="center_vertical"
android:gravity="center"
android:minWidth="0dp"
android:minHeight="0dp"
android:text="+"
android:textColor="@color/ash"
android:textSize="@dimen/fm_food_price_text_size" />
I want to know how to set button 24dp and show "+" text. as like below image. In this image i used textView, so text is visibile. I want this by using button.
Solution
I have solved by using ImageButton instead of button.
<ImageButton
android:id="@+id/incrementButtton"
android:layout_width="24dp"
android:layout_height="24dp"
android:padding="8dp"
android:layout_gravity="center"
android:gravity="center"
android:background="?attr/selectableItemBackgroundBorderless"
android:src="@drawable/ic_minus_symbol"
android:scaleType="centerInside"
/>
for ripple effect i used
android:background="?attr/selectableItemBackgroundBorderless"
Answered By - Navin Kumar
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.