小编Sto*_*000的帖子

更改TimePickerDialog样式

我想更改TimePicker的样式,但是无法更改钟面和标题背景的颜色。这是我的XML样式代码-

    <style name="DateTimeDialog" parent="Theme.AppCompat.Dialog">
        <item name="android:colorBackground">@color/colorWhite</item>
        <item name="android:textColorPrimary">#000000</item>
        <item name="android:headerBackground">#000000</item>
        <item name="android:textColorSecondary">#000000</item>
        <item name="android:button">@color/colorWhite</item>
        <item name="android:colorPrimaryDark">@color/colorPrimaryDark</item>
        <item name="android:colorAccent">@color/colorSecondary</item>
        <item name="android:textColor">@color/colorSecondaryDark</item>
    </style>
Run Code Online (Sandbox Code Playgroud)

原色是海军蓝色,而强调色/次要颜色是浅蓝色(以防万一,您希望将其描绘出来)。这是目前的样子-

当前风格

在此处输入图片说明

我希望能够更改灰色背景。

注意:“ android:background”属性在这里不起作用。它仅更改标题中显示的时间中“:”后面的微小区域的颜色。任何帮助/资源表示赞赏。谢谢!

android android-dialog android-timepicker android-styles

1
推荐指数
1
解决办法
1918
查看次数

如何在 Spring boot Controller 中接受 GET 参数并返回适当的对象

我对 Spring Boot 非常陌生,我不知道该类@Controller。如果我在 Spring Boot 中找不到数据库中的特定对象,我应该传递什么?如果我将返回类型声明为Response Entity并发送 null User 对象,会更好吗?

//Get single user
@GetMapping("/users/{id}")
public User getUser(@PathVariable String id){
    try {
        Long i = Long.parseLong(id);
    } catch (NumberFormatException ex) {
        return ????    //Can't figure out what to return here. 
    }
    return userService.getUser(id);
}
Run Code Online (Sandbox Code Playgroud)

我希望消费者知道他们发送了无效的字符串。

2)此外,用户的变量id是类型LongLong那么我应该采用函数中的参数getUser还是采用字符串并解析它?Long如果在链接中发送字符串,则采取 a会使我的服务器崩溃。

spring-mvc spring-data-jpa spring-boot spring-restcontroller spring-rest

1
推荐指数
1
解决办法
5227
查看次数