Supposedly, in the material theme, there are two types of buttons: raised, and flat:
When I create a <Button>
, it looks like the "raised" button. How, using markup, can I make the "flat button". Is there any style or attribute to do it? I found this image in the theme editor.
FButton is a custom Button of Android with "Flat UI" concept. FButton's design get inspiration from designmono. This library is very small and highly customizable.
Using colors (background, text, border) Using custom shapes like circle, rounded corners and more. You can add images to your buttons to customize them. Using drawables to make gradients, dotted borders and more.
We can set custom shapes on our button using the xml tag <shape> . These xml files are created in the drawable folder too. shape can be used inside selectors . The shape can be set to rectangle (default), oval , ring , line .
You can use the style="?android:attr/borderlessButtonStyle
on your Button
as follows:
<Button android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="TextGoesHere" style="?android:attr/borderlessButtonStyle" />
BorderlessButtonStyle
Style for buttons without an explicit border, often used in groups.
Also you can use those Flat Buttons
Add dependency to build.gradle
dependencies { compile 'com.android.support:appcompat-v7:25.0.0' }
Then in your layout XML file, add a style attribute to the Button
<Button android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="Button" style="@style/Widget.AppCompat.Button.Borderless"/>
You can change the color when the button is pressed by defining a custom style
<style name="FlatButtonStyle" parent="Theme.AppCompat.Dark"> <item name="colorControlHighlight">@color/transparent</item> </style>
and applying this style in layout XML
android:theme="@style/FlatButtonStyle"
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With