问题标签 [android-5.1.1-lollipop]
For questions regarding programming in ECMAScript (JavaScript/JS) and its various dialects/implementations (excluding ActionScript). Note JavaScript is NOT the same as Java! Please include all relevant tags on your question; e.g., [node.js], [jquery], [json], [reactjs], [angular], [ember.js], [vue.js], [typescript], [svelte], etc.
android - Android getResources().getDrawable() deprecated API 22
With new android API 22 getResources().getDrawable()
is now deprecated.
Now the best approach is to use only getDrawable()
.
What changed?
android - 断言不适用于 android 5.1.1?
我的代码assert
广泛使用调用。
更新到 5.1.1(在 Nexus 4 和 Nexus 5 上测试)后,断言调用被忽略。在开发人员选项下选择“调试应用程序”没有任何区别。
有没有人解决这个问题?(在我被迫用 some 替换所有断言之前myAssert(..)
)。
更新:
我打开的问题已用此评论关闭:
debug.assert 从未实现。
看来对这个工具的需求并不多,打败了我。
assert
是一个非常强大的工具。
一些优点:
在运行时启用和禁用:
adb shell setprop debug.assert 1(或 0)
与一些相比
public static myAssert(boolean condition,String message)
- myAssertmessage
在任何情况下都会执行/评估 ,而assert
只有当condition
为假时才会这样做。因此myAssert(..)
CPU 和内存的开销很大,特别是如果您需要有意义的消息,例如Arrays.toString(..)
.myAssert
如果您正在进行分析,您将需要跳过任何呼叫。
android - android lollipop ViewGroup child hierarchy changes?
I have an app that has a minSdk of 15 and I'm working out all the bugs that came with the lollipop upgrade. Our software is very complex and it dynamically creates views using custom ViewGroups and then an array of elements that are explicitly sized and placed inside the group. I'm running into an issue where for example I'll have a ViewGroup and the first child object is a Button...this button is sized to fill the view (not clickable). The second child is a FrameLayout containing a single view. This single view is a video object. In all prior versions of Android this works just fine. The FrameLayout is layered over the button (that is acting as a background) and the video is inside the framelayout. You can interact with the video without any issues.
Something changed in lollipop - suddenly, even though the button is showing up as the 0 index element, it is laying OVER the rest of the children...so I cannot get to the video underneath. If I remove that button element, the video renders and plays just fine...I have no issues interacting with it.
I ran the app in UI Automator Viewer just to make sure I was really setting up the UI as I expected (keep in mind the entire view is dynamically rendered at runtime using image/video assets and xml config files).
I'm not able to share code since this is proprietary software, but I am working on a little test project to see if I can manually recreate the issue with static objects. Once I get that up and running I'll be sure to update this ticket. For now, here is a screenshot of the hierarchy:
https://goo.gl/photos/a8on9CJDnN66XYnV6
Notice the highlighted object, this is the custom ViewGroup, the children below it are what I am describing above.
Does anyone know of a change in Lollipop that would effect the ordering of things? I found earlier that if you have a disabled object but don't have a disabled state drawable assigned to that object it would become invisible, previous versions just used one of the other state drawables..okay that makes sense and it was very easy to fix, but this object is not invisible...so it must be something different.
Any direction would be greatly appreciated. ~A
UPDATE -- FIXED
With the help of @alanv and @BladeCoder I figured out this functionality was due to the new elevation feature of Material design. I was able to fix my particular issue by first checking what version of android the device was using, and if lollipop, I just add this new property to the button:
android:stateListAnimator="@null"
This prevents my explicit child hierarchy from being overridden by the OS.
android - Android 5+ 屏幕锁定无法使用 WindowManager 添加视图
我有一个识别呼叫应用程序,它在 android 5+ 之前运行良好。
基本上,我有一个 BroadcastReceiver,它在识别呼叫后电话响起时“做他的事情”,我添加了一个小视图。
在新的 Galaxy Edge s6 上,当手机锁定时它不起作用。
这是我的相关代码
app.PhoneLayout 包含充气后的布局等。
有谁知道为什么会发生这种情况?以及如何解决这个问题,以便即使手机锁定也能显示我的视图?
它在旧设备上运行良好。
希望有人可以分享他对此的想法
android - 使用 Runtime.exec(...) 运行 dpm
这个答案表明 Android 应用程序可以dpm
像这样运行:
这在我运行 5.1.1 的 Nexus 4 上静默失败。shell 返回错误代码 0(成功)并且没有控制台输出。尽管取得了明显的成功,但我的应用程序并没有成为设备所有者。设备刚恢复出厂设置,未配置用户帐户。
作为控制,我尝试运行垃圾命令而不是dpm
. 它按预期失败。
这有用吗?是故意削弱的吗?
android - 我们可以在棒棒糖设备中显示旧式时间选择器(Pre Lollipop Time Picker)吗
我想在棒棒糖设备中显示较旧的时间选择器(如前棒棒糖设备时间选择器)。可以吗?这是可能的。
android - 与 kitkat 相比,棒棒糖中的应用程序冷启动或应用程序启动时间增加了
与 kitkat 股票 android 版本相比,大多数应用程序冷启动值在棒棒糖股票 android 中回归。
我们使用相机记录并观察到所有应用程序在棒棒糖股票 android 中的启动时间比 kitkat 股票 android 多 20%。
棒棒糖中这些回归的变化是什么?如何解决这个问题?
android-emulator - Update Android System WebView on SDK Emulator
I have a problem with my cordova app after the latest Android System WebView update (44.0.2403.39) on Android 5.x devices.
I would like to update the replicate the problem on the SDK Emulator. But the standard image of Android 5.1 comes with the WebView version 39.
Is there any way to update this component on the emulator?
I've found the APK for the update here but after installing it shows two entries on the App list on System Settings and it's not updating. So I can't replicate the problem.
The first one is the view that comes with the emulator v39 and the second one is the v44
- Also is there any way to modify the system files on the emulator to update it manually?
- Or a programatically way to change Webview with adb shell?
android - 如何以编程方式在 android 5.1.1 上启用/禁用 USB 网络共享?
我需要一种通过 API 启用/禁用网络共享的方法。此处发布的大多数解决方案都适用于 android 4.4 或更低版本。
我已经通过以下解决方案(没有工作):
我知道支持此功能的 API 通常仅适用于系统应用程序(常规应用程序没有 MANAGE_USB 权限),但是对于 android 5.1.1 有没有办法解决这个问题?
android - 棒棒糖中的 SwitchPreference 回调行为更改
在我们的项目中,我们使用类似于 wifi 设置的 SwitchPreference。用户可以通过单击切换按钮来切换值,用户可以通过单击标题来查看更多选项。
但这在棒棒糖中不起作用。我可以看到棒棒糖的一些行为变化。
在奇巧:
当用户点击切换按钮时,调用 onPreferenceChanged回调,当用户点击标题时,调用 onPreferenceClicked。
在棒棒糖中:您点击切换按钮或标题onPreferenceClicked总是被调用,然后onPreferenceChanged被调用。如何在棒棒糖中获得相同的行为?这种行为正在破坏我们的功能。