How To Create Borderless Button Using Style From Style.xml File (along With All Other Styles)
I am trying to create a borderless button, but I also have many other styles for my button and I want to design button borderless by embedding code into my style.xml file. One way
Solution 1:
You can do this by making Custom Button class which extend default Button class, and use this class everywhere, and second possible solution is use
If it's selected or not selected you should use a toggle button https://developer.android.com/reference/android/widget/ToggleButton.html
Be aware that there are still 4 states for that
You define them in a selector like this
<selectorxmlns:android="http://schemas.android.com/apk/res/android"><itemandroid:state_checked="true"android:state_pressed="true"android:drawable="@drawable/likeactivepressed" /><itemandroid:state_pressed="true"android:drawable="@drawable/likeinitialpressed"/><itemandroid:state_checked="true"android:drawable="@drawable/likeon"/><itemandroid:drawable="@drawable/likeinitial"/></selector>
Then define it in your button like this
android:background="@drawable/like_button"
Solution 2:
Solution 3:
I think this is what you're looking for.
<stylename="style_name"parent="@style/Widget.AppCompat.Button.Borderless"><!-- your style --></style>
Post a Comment for "How To Create Borderless Button Using Style From Style.xml File (along With All Other Styles)"