设计像在Android L中的时钟中找到的日期选择器 [英] Designing day chooser like found in clock in android L

查看:64
本文介绍了设计像在Android L中的时钟中找到的日期选择器的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在开发一个想要将日期选择器放置如下的应用程序(我在android L的时钟应用程序中看到过).有人知道如何实现吗?还是有任何实现此目的的库或项目?

I am working on an app where I want to put day chooser like below (which I saw in clock app of android L). Anyone knows how to achieve it? Or is there any library or project implementing this is present?

推荐答案

这是我尝试的广播组的一个示例.也许对您有帮助.看看一次.

Here is an example by radio group which i tried. maybe its helpful for you. just take a look once.

您的主要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

here radiobtn_bck xml in drawable folder

<?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

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

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中的时钟中找到的日期选择器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆