I'm struggling with the top answer here: How to mimic the Material-design raised button style, even for pre-Lollipop (minus the special effects)?
I made a mock program with the bare essentials listed by @spierce7
- In gradle:
compile "com.android.support:appcompat-v7:24.1.1"
// (24.2.1 in my case) - In styles.xml:
<style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar">
- In Android Manifest:
android:theme="@style/AppTheme"
- My Activity extends
AppCompatActivity
- My button is an
AppCompatButton
(or a plainButton
, doesn't matter)
Here is the layout XML:
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/content_main"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:paddingBottom="@dimen/activity_vertical_margin"
android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin"
android:paddingTop="@dimen/activity_vertical_margin"
app:layout_behavior="@string/appbar_scrolling_view_behavior"
tools:showIn="@layout/activity_main">
<android.support.v7.widget.AppCompatTextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Hello World!"
android:id="@+id/textview_helloworld"/>
<android.support.v7.widget.AppCompatButton
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Button"
android:layout_below="@id/textview_helloworld"/>
</RelativeLayout>
The result is this:
The corner floating button inflates with the "raised look", but not my AppCompatButton.
And I'm still not seeing raised buttons in pre-Lollipop. What am I missing or doing wrong?