Android警报对话框在Lollipop上未正确设置样式

时间:2014-10-28 02:06:18

标签: android android-5.0-lollipop material-design

我已经尝试了一切来使这项工作无法解决。

我正在尝试在我的应用中使用警告对话框。它适用于KitKat,但不适用于Lollipop。

我甚至尝试在GitHub上使用许多材质对话框,然后再次在Kitkat上工作,但不在Lollipop上工作。

我正在使用库存nexus工厂映像测试我的Nexus 5。

KITKAT与GITHUB材料对话

enter image description here

KITKAT with STOCK ALERT DIALOG

enter image description here

使用GITHUB材料对话的LOLLIPOP

enter image description here

LOLLIPOP with STOCK ALERT DIALOG

enter image description here

此外,这是github上安装在同一台设备上的库,它不能正常工作。所以关于我的应用程序的东西导致了这一点。它可能是什么

enter image description here

2 个答案:

答案 0 :(得分:26)

android:fitsSystemWindows =“true”是罪魁祸首。

我在styles.xml中声明了这个。

从styles.xml中删除它并放在我的布局中,它现在正在运行。

答案 1 :(得分:0)

我遇到了同样的问题,并且在我的任何styles.xml上都找不到任何fitsSystemWindows。

要解决这个问题,我必须将Layout放在FrameLayout中并将边距添加到Layout中,如下所示:

override func didMoveToView(view: SKView) {
    var newGameButton : SKSpriteNode!
    newGameButton = SKSpriteNode(imageNamed: "button")
    newGameButton.position = CGPointMake(CGRectGetMidX(self.frame), CGRectGetMidY(self.frame)+5)
    newGameButton.size = CGSizeMake(200.0, 40.0)
    newGameButton.name = "newGame"
    newGameButton.isAccessibilityElement = true
    newGameButton.userInteractionEnabled = true
    newGameButton.accessibilityLabel = "newGame"
    self.addChild(newGameButton)
}

override func touchesBegan(touches: Set<UITouch>, withEvent event: UIEvent?) {
    let touch = touches.first as UITouch!
    let location = touch.locationInNode(self)
    let nodes = self.nodesAtPoint(location)
    for  node in nodes {
        if (node.name == "newGame") {
            viewController.beginNewGame()
            break
        }
    }
}