像 android L 中的时钟一样设计日期选择器
Designing day chooser like found in clock in android L
我正在开发一个应用程序,我想在其中放置如下所示的日期选择器(我在 android L 的时钟应用程序中看到了)。任何人都知道如何实现它?或者是否存在实现此功能的库或项目?
这是我试过的广播组的例子。也许它对你有帮助。只看一次。
你的主要 xml 文件
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="#655EF9"
android:orientation="horizontal">
<CheckBox
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="@drawable/radiobtn_bck"
android:button="@null"
android:checked="true"
android:gravity="center"
android:text="S" />
<CheckBox
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="10dp"
android:background="@drawable/radiobtn_bck"
android:button="@null"
android:gravity="center"
android:text="M" />
<CheckBox
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="10dp"
android:background="@drawable/radiobtn_bck"
android:gravity="center"
android:button="@null"
android:text="T" />
</LinearLayout>
此处 radiobtn_bck xml 在可绘制文件夹中
<?xml version="1.0" encoding="utf-8"?>
<item android:drawable="@drawable/bg_shape" android:state_checked="true" />
<item android:drawable="@drawable/bg_shape" android:state_pressed="true" />
<item android:drawable="@drawable/bg_shape" android:state_focused="true" />
<item android:drawable="@drawable/bg_shape_purple" android:state_checked="false" />
bg_shape.xml
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="oval">
<solid android:color="#ffffff" />
<size
android:width="40dp"
android:height="40dp" />
bg_shape_purple.xml
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="oval">
<solid android:color="#655EF9" />
<size
android:width="40dp"
android:height="40dp" />
我正在开发一个应用程序,我想在其中放置如下所示的日期选择器(我在 android L 的时钟应用程序中看到了)。任何人都知道如何实现它?或者是否存在实现此功能的库或项目?
这是我试过的广播组的例子。也许它对你有帮助。只看一次。
你的主要 xml 文件
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="#655EF9"
android:orientation="horizontal">
<CheckBox
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="@drawable/radiobtn_bck"
android:button="@null"
android:checked="true"
android:gravity="center"
android:text="S" />
<CheckBox
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="10dp"
android:background="@drawable/radiobtn_bck"
android:button="@null"
android:gravity="center"
android:text="M" />
<CheckBox
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="10dp"
android:background="@drawable/radiobtn_bck"
android:gravity="center"
android:button="@null"
android:text="T" />
</LinearLayout>
此处 radiobtn_bck xml 在可绘制文件夹中
<?xml version="1.0" encoding="utf-8"?>
<item android:drawable="@drawable/bg_shape" android:state_checked="true" />
<item android:drawable="@drawable/bg_shape" android:state_pressed="true" />
<item android:drawable="@drawable/bg_shape" android:state_focused="true" />
<item android:drawable="@drawable/bg_shape_purple" android:state_checked="false" />
bg_shape.xml
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="oval">
<solid android:color="#ffffff" />
<size
android:width="40dp"
android:height="40dp" />
bg_shape_purple.xml
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="oval">
<solid android:color="#655EF9" />
<size
android:width="40dp"
android:height="40dp" />