【发布时间】:2016-12-25 06:01:01
【问题描述】:
编辑:
我设法使用此代码删除了状态栏的当前背景(以及导航栏的背景)
ANativeActivity_setWindowFlags(PANativeActivity(System::DelphiActivity),
TJWindowManager_LayoutParams::JavaClass->FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS,
TJWindowManager_LayoutParams::JavaClass->FLAG_TRANSLUCENT_STATUS);
仍然不知道如何添加新的背景颜色
这不起作用:
_di_JWindow androidWindow = SharedActivity()->getWindow();
androidWindow->setStatusBarColor(17170432);
================================================ =======================
原帖:
我正在尝试为使用 FireMonkey/RAD Studio 制作的 Android 应用的状态栏着色。
为了在 Java 中实现它,我通常使用以下代码:
Window window = activity.getWindow();
window.clearFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS);
window.addFlags(WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS);
window.setStatusBarColor(activity.getResources().getColor(R.color.my_statusbar_color));
在 RAD Studio 中,我正在尝试这样做
首先我在标头中包含 Android 库:
#ifdef __ANDROID__
#include <FMX.Helpers.Android.hpp>
#include <Androidapi.JNIBridge.hpp>
#include <Androidapi.JNI.Os.hpp>
#include <Androidapi.JNI.JavaTypes.hpp>
#include <Androidapi.JNI.GraphicsContentViewText.hpp>
#include <Androidapi.JNI.Util.hpp>
#include <Androidapi.JNI.App.hpp>
#include <Androidapi.JNI.Embarcadero.hpp>
#include <Androidapi.Jni.hpp>
#endif
然后当我试图打电话时:
JWindow androidWindow = JNativeActivity::getWindow();
我收到超过 100 个错误,如下所示:
[bccaarm Error] HeaderFooterTemplate.cpp(67): call to non-static member function without an object argument
[bccaarm Error] HeaderFooterTemplate.cpp(67): variable type 'Androidapi::Jni::Graphicscontentviewtext::JWindow' is an abstract class
sysmac.h(327): unimplemented pure virtual method 'QueryInterface' in 'JWindow'
sysmac.h(328): unimplemented pure virtual method 'AddRef' in 'JWindow'
sysmac.h(329): unimplemented pure virtual method 'Release' in 'JWindow'
Androidapi.JNI.JavaTypes.hpp(763): unimplemented pure virtual method 'equals' in 'JWindow'
Androidapi.JNI.JavaTypes.hpp(764): unimplemented pure virtual method 'getClass' in 'JWindow'
Androidapi.JNI.JavaTypes.hpp(765): unimplemented pure virtual method 'hashCode' in 'JWindow'
Androidapi.JNI.JavaTypes.hpp(766): unimplemented pure virtual method 'notify' in 'JWindow'
Androidapi.JNI.JavaTypes.hpp(767): unimplemented pure virtual method 'notifyAll' in 'JWindow'
Androidapi.JNI.JavaTypes.hpp(768): unimplemented pure virtual method 'toString' in 'JWindow'
Androidapi.JNI.JavaTypes.hpp(769): unimplemented pure virtual method 'wait' in 'JWindow'
Androidapi.JNI.JavaTypes.hpp(770): unimplemented pure virtual method 'wait' in 'JWindow'
Androidapi.JNI.JavaTypes.hpp(771): unimplemented pure virtual method 'wait' in 'JWindow'
Androidapi.JNI.GraphicsContentViewText.hpp(18831): unimplemented pure virtual method 'addContentView' in 'JWindow'
Androidapi.JNI.GraphicsContentViewText.hpp(18832): unimplemented pure virtual method 'addFlags' in 'JWindow'
Androidapi.JNI.GraphicsContentViewText.hpp(18833): unimplemented pure virtual method 'clearFlags' in 'JWindow'
Androidapi.JNI.GraphicsContentViewText.hpp(18834): unimplemented pure virtual method 'closeAllPanels' in 'JWindow'
Androidapi.JNI.GraphicsContentViewText.hpp(18835): unimplemented pure virtual method 'closePanel' in 'JWindow'
Androidapi.JNI.GraphicsContentViewText.hpp(18836): unimplemented pure virtual method 'findViewById' in 'JWindow'
Androidapi.JNI.GraphicsContentViewText.hpp(18837): unimplemented pure virtual method 'getAllowEnterTransitionOverlap' in 'JWindow'
这是我使用 C++ 的第一步,所以我不确定我做得对。
【问题讨论】:
标签: android c++ java-native-interface c++builder firemonkey