Skip to content

Instantly share code, notes, and snippets.

@fatorx
Created May 4, 2015 19:10
Show Gist options
  • Save fatorx/d5d0a41ab49511e591f7 to your computer and use it in GitHub Desktop.
Save fatorx/d5d0a41ab49511e591f7 to your computer and use it in GitHub Desktop.
Android - Criar um Button sublinhado
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<gradient
android:angle="90"
android:startColor="#f00"
android:centerColor="@android:color/transparent"
android:centerX="0.01" />
</shape>
<!--
Para mudar a posição da borda (não necessariamente ser sublinhado)
0 = left
90 = bottom
180 = right
270 = top
Referência: http://stackoverflow.com/a/23754336/1222311
-->
<Button
android:text="@string/title_btn"
android:layout_width="150dp"
android:layout_height="match_parent"
style="@style/linksActive"
/>
<resources>
<style name="linksActive">
<item name="android:background">@drawable/bg_shape</item>
</style>
</resources>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment