我有一个名为“and.doc”的文件,其中包含大量记录,每个记录都具有这种形状
表达:防御;
所以我试图
;作为分隔符我正在使用此代码
try {
mf =new File("/home/agh/AndroidStudioProjects/Dicod/app/src/main/res/raw/and.doc");
inputFile = new Scanner(mf);
inputFile.useDelimiter(";");
while (inputFile.hasNext())
{
String x = inputFile.next();
Toast.makeText(getApplicationContext(),x,Toast.LENGTH_LONG).show();
//Splitting and adding to the databse
}
}
catch(FileNotFoundException e) {
e.printStackTrace();
}`
Run Code Online (Sandbox Code Playgroud)
但我不断收到此错误
06-23 04:38:28.771 23620-23620/? W/System.err: java.io.FileNotFoundException: /home/agh/AndroidStudioProjects/Dicod/app/src/main/res/raw/and.txt: open failed: ENOENT (No such file or directory)
06-23 04:38:28.771 23620-23620/? W/System.err: at libcore.io.IoBridge.open(IoBridge.java:465)
06-23 04:38:28.771 23620-23620/? W/System.err: at java.io.FileInputStream.<init>(FileInputStream.java:76)
06-23 …Run Code Online (Sandbox Code Playgroud) 我在编译代码时遇到此错误:
<!-- language: lang-none -->
Program type already present:
com.google.android.material.internal.package-info
Message{kind=ERROR, text=Program type already present:
com.google.android.material.internal.package-info, sources=
[Unknown source file], tool name=Optional.of(D8)}
Run Code Online (Sandbox Code Playgroud)
当我搜索类似的错误时,它建议添加
configurations {all*.exclude group: 'com.android.support', module: 'support-v13'}
Run Code Online (Sandbox Code Playgroud)
或将这些行添加到“ gradle.properties ”文件
android.useAndroidX = true
android.enableJetifier = false
Run Code Online (Sandbox Code Playgroud)
但这些解决方案都不适合我,这是我的 gradle 文件
app
apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-android-extensions'
android {
compileSdkVersion 28
defaultConfig {
applicationId "com.example.agh.yaomi"
minSdkVersion 17
targetSdkVersion 28
multiDexEnabled true
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), …Run Code Online (Sandbox Code Playgroud) 我正在尝试使用 Compose 实现这个自定义形状
但由于某种原因,分隔符偏移圆用虚线绘制,这是代码
@Preview
@Composable
private fun ReceiptSeparator () {
Row(modifier = Modifier.fillMaxWidth().padding(horizontal = 8.dp) ,
verticalAlignment = Alignment.CenterVertically ,) {
Box(
modifier = Modifier
.requiredSize(50.dp)
.background(Color.White)
.offset(-40.dp)
.clip(CircleShape)
.border(BorderStroke(2.dp, Color.Gray))
){}
Box(
Modifier
.height(1.dp)
.requiredWidth(250.dp)
.weight(3f)
.background(Color.Gray, shape = DottedShape(step = 20.dp))
){}
Box(
modifier = Modifier
.offset(40.dp)
.clip(CircleShape)
.border(BorderStroke(2.dp, Color.Gray))
.background(Color.White)
.size(50.dp)
){}
}
}
Run Code Online (Sandbox Code Playgroud)
为什么圆是用虚线绘制的以及如何正确地实现这个形状?