在 LG Q6 上以编程方式更改导航栏颜色
Changing the navigation bar color programmatically on LG Q6
我尝试通过主题或编程方式更改导航栏的颜色。
这是我到目前为止尝试过的方法:
风格-v21:
<style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar">
<item name="colorPrimary">#123456</item>
<item name="colorPrimaryDark">#012345</item>
<item name="colorAccent">#987654</item>
<item name="android:windowDrawsSystemBarBackgrounds">true</item>
<item name="android:navigationBarColor">@color/colorAccent</item>
</style>
以编程方式:
Window w = getWindow();
w.addFlags(WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS);
w.setNavigationBarColor(ContextCompat.getColor(this, R.color.colorAccent));
问题是:它在 Nexus 设备(使用 Android 7.1.1)上完美运行,但在 LG Q6(也使用 Android 7.1.1).
我认为有办法做到这一点(因为 Youtube 应用程序有自己的导航栏颜色),但我不知道怎么做。
我也尝试了几乎所有方法 here, , here, and here,但没有成功。
感谢您的帮助!
尝试使用
<application>
....
<meta-data android:name="android.max_aspect" android:value="2.5" />
...
</application>
在你的AndroidManifest.xml
我尝试通过主题或编程方式更改导航栏的颜色。
这是我到目前为止尝试过的方法:
风格-v21:
<style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar">
<item name="colorPrimary">#123456</item>
<item name="colorPrimaryDark">#012345</item>
<item name="colorAccent">#987654</item>
<item name="android:windowDrawsSystemBarBackgrounds">true</item>
<item name="android:navigationBarColor">@color/colorAccent</item>
</style>
以编程方式:
Window w = getWindow();
w.addFlags(WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS);
w.setNavigationBarColor(ContextCompat.getColor(this, R.color.colorAccent));
问题是:它在 Nexus 设备(使用 Android 7.1.1)上完美运行,但在 LG Q6(也使用 Android 7.1.1).
我认为有办法做到这一点(因为 Youtube 应用程序有自己的导航栏颜色),但我不知道怎么做。
我也尝试了几乎所有方法 here,
感谢您的帮助!
尝试使用
<application>
....
<meta-data android:name="android.max_aspect" android:value="2.5" />
...
</application>
在你的AndroidManifest.xml