我的应用程序在所有 android 版本中创建文件夹都没有问题,除了android Q,我不知道为什么我的代码在 android q 中不起作用
这是我的代码:
File dir = new File("/sdcard/test");
try{
if(dir.mkdir()) {
Log.d("DOWNLOAD","Directory created");
} else {
Log.d("DOWNLOAD","Directory is not created");
}
}catch(Exception e){
e.printStackTrace();
}
Run Code Online (Sandbox Code Playgroud) 我有一个主题,用户可以选择浅色或深色,一切正常,但是有两个问题:
我试图改变背景但没有用,我改变了它的颜色,我还使用了可绘制的形状。无论如何,它不起作用并且对两者都使用一种颜色。
样式文件
<style name="AppTheme" parent="Theme.MaterialComponents.DayNight.NoActionBar"/>
Run Code Online (Sandbox Code Playgroud)
值/themes.xml
<style name="AppTheme" parent="Theme.MaterialComponents.DayNight.NoActionBar"/>
Run Code Online (Sandbox Code Playgroud)
值夜/themes.xml
<style name="Theme.MaterialComponents.DayNight.NoActionBar"
parent="Theme.MaterialComponents.Light.NoActionBar">
<item name="colorPrimary">@color/colorPrimary</item>
<item name="colorPrimaryDark">@color/colorPrimaryDark</item>
<item name="colorAccent">@color/colorAccent</item>
<item name="android:windowBackground">@drawable/window_background</item>
</style>
Run Code Online (Sandbox Code Playgroud)
windows_background
<style name="Theme.MaterialComponents.DayNight.NoActionBar"
parent="Theme.MaterialComponents.NoActionBar">
<item name="colorPrimary">@color/colorPrimary</item>
<item name="colorPrimaryDark">@color/TabBackground</item>
<item name="colorAccent">@color/green_inactive</item>
<item name="android:windowBackground">@drawable/window_background_dark</item>
</style>
Run Code Online (Sandbox Code Playgroud)
windows_background_dark
和上面的代码类似,只是颜色不同
这就是我加载主题的方式
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="rectangle">
<solid android:color="#64b5f6"/>
</shape>
Run Code Online (Sandbox Code Playgroud) 嗨,我想混淆我的 apk,但是当我使用minifyEnabled true时,我的应用程序在发布模式下崩溃,所以我将我的 as 更新到 3.4.2,我意识到有一个名为 R8 的新系统我已经激活了它,但我的代码仍然可读
我做的事
buildTypes {
release {
useProguard false
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
Run Code Online (Sandbox Code Playgroud)
dependencies {
classpath 'com.android.tools.build:gradle:3.4.2'
}
Run Code Online (Sandbox Code Playgroud)
并在 gradle.properties 中
android.enableJetifier=true
android.useAndroidX=true
org.gradle.jvmargs=-Xmx1536m
android.enableR8 = true
Run Code Online (Sandbox Code Playgroud)
嗨,我有一个基于主分支的开发分支。我在开发分支中进行了更改。现在,我的问题是如果要更新 master 分支,如何在不丢失我在 develop 分支中所做的更改的情况下升级基于 master 分支的 develop 分支?
我想要报告加密文件的进度这是我的代码我该怎么做?
using (FileStream destination = new FileStream(destinationFilename, FileMode.CreateNew, FileAccess.Write, FileShare.None))
using (CryptoStream cryptoStream = new CryptoStream(destination, transform, CryptoStreamMode.Write))
using (FileStream source = new FileStream(sourceFilename, FileMode.Open, FileAccess.Read, FileShare.Read))
{
await source.CopyToAsync(cryptoStream);
}
Run Code Online (Sandbox Code Playgroud) android ×3
java ×3
android-10.0 ×1
c# ×1
filestream ×1
git ×1
git-branch ×1
github ×1
mkdir ×1
obfuscation ×1
progress ×1
proguard ×1
styles ×1
wpf ×1