Im using the appcompat_v7 library.
The documentation says:
[...] AppCompat provides a similar behavior in earlier versions of Android for a subset of the user interface widget:
Everything provided by the AppCompats toolbar (action modes, etc.)
- Edittext
- Spinner
- Checkbox
- Radiobutton
- Switch (use the new android.support.v7.widget.SwitchCompat file)
- CheckedTextView You donβt need to do anything special to make this work, just use these controls in your layouts as usual, and AppCompat will do the rest (with a few caveats, see Frequently Asked Questions below).
This is my code:
values ββ/ styles.xml
<style name="AppBaseTheme" parent="Theme.AppCompat">
<item name="colorPrimary">@color/material_blue_grey_800</item>
<item name="colorPrimaryDark">@color/material_blue_grey_950</item>
<item name="colorAccent">@color/material_deep_teal_200</item>
</style>
Layout / activity_main.xml
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
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"
tools:context="com.example.lollipoptest.MainActivity" >
<TextView
android:id="@+id/textView1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/hello_world" />
<CheckBox
android:id="@+id/checkBox1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@+id/textView1"
android:layout_centerHorizontal="true"
android:layout_marginTop="28dp"
android:text="CheckBox" />
<RadioButton
android:id="@+id/radioButton1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@+id/checkBox1"
android:layout_centerHorizontal="true"
android:text="RadioButton" />
<EditText
android:id="@+id/editText1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@+id/radioButton1"
android:layout_centerHorizontal="true"
android:ems="10" >
<requestFocus />
</EditText>
No changes to default default MainActivity.java file
Material. .
.
?
:
https://drive.google.com/file/d/0B1jx6rK5CDqTRnhYVDU3V21JRlk/view?usp=sharing