我用材料。我将为 TextInputLayout 使用一种颜色作为背景,但类似于下面的颜色!提示背景未更改。我使用了样式并想进行更改,但没有奏效。在布局本身中,我尝试再次应用更改!如何解决这个问题?
笔记
图片中标签用户名的背景不透明,它覆盖了一些TextInputEditText
在build.gradle 中
implementation 'com.google.android.material:material:1.1.0'
Run Code Online (Sandbox Code Playgroud)
在风格
<!-- Base application theme. -->
<style name="AppTheme" parent="Theme.MaterialComponents.Light.DarkActionBar">
<!-- Customize your theme here. -->
<item name="colorPrimary">@color/colorPrimary</item>
<item name="colorPrimaryDark">@color/colorPrimaryDark</item>
<item name="colorAccent">@color/colorAccent</item>
<item name="textAppearanceSubtitle1">@style/TextAppearance.App.Subtitle1</item>
<item name="textAppearanceCaption">@style/TextAppearance.App.Caption</item>
<item name="shapeAppearanceSmallComponent">@style/ShapeAppearance.App.SmallComponent</item>
</style>
<style name="AppTheme.NoActionBar">
<item name="windowActionBar">false</item>
<item name="windowNoTitle">true</item>
</style>
<style name="AppTheme.AppBarOverlay" parent="ThemeOverlay.MaterialComponents.Dark.ActionBar"/>
<style name="AppTheme.PopupOverlay" parent="ThemeOverlay.MaterialComponents.Light"/>
<style name="TextAppearance.App.Subtitle1" parent="TextAppearance.MaterialComponents.Subtitle1">
<item name="colorControlActivated">@color/white</item>
<item name="android:colorControlActivated">@color/white</item>
</style>
<style name="TextAppearance.App.Caption" parent="TextAppearance.MaterialComponents.Caption">
<item name="android:textColorTertiary">@color/white</item>
<item name="android:textColorTertiaryInverse">@color/white</item>
<item name="colorControlActivated">@color/white</item>
<item name="android:colorControlActivated">@color/white</item>
</style>
<style …Run Code Online (Sandbox Code Playgroud) android material-design android-textinputlayout android-textinputedittext
我要建立一个项目。当我创建项目时,遇到以下错误
ERROR: Failed to resolve: espresso-core
Affected Modules: mvp-app
ERROR: Failed to resolve: runner
Affected Modules: mvp-app
Run Code Online (Sandbox Code Playgroud)
和我的 build.gradle(module) 文件
apply plugin: 'com.android.application'
android {
compileSdkVersion 28
defaultConfig {
applicationId "ir.sabmanage.mvp"
minSdkVersion 16
targetSdkVersion 28
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'com.android.support:appcompat-v7:28.0.0'
implementation 'com.android.support.constraint:constraint-layout:1.1.3'
implementation 'com.android.support:design:28.0.0'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:1.0.2'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
implementation 'com.android.support:exifinterface:28.0.0'
implementation 'com.ss.bottomnavigation:bottomnavigation:1.5.2'
implementation 'com.squareup.retrofit2:retrofit:2.4.0'
implementation …Run Code Online (Sandbox Code Playgroud) 我想使用 Retrofit2 和 rxjava3 但我看到以下错误
Caused by: java.lang.IllegalArgumentException: Could not locate call adapter for io.reactivex.rxjava3.core.Observable<java.lang.Object>.
Tried:
* retrofit2.adapter.rxjava2.RxJava2CallAdapterFactory
* retrofit2.CompletableFutureCallAdapterFactory
* retrofit2.DefaultCallAdapterFactory
Run Code Online (Sandbox Code Playgroud)
此错误表明Rxjava 没有适配器,但我将其添加到下面的行中
.addCallAdapterFactory(RxJava2CallAdapterFactory.create())
public class ServiceGenerator {
private static final String BASE_URL = "http://example.com/";
private static final OkHttpClient okHttpClient = new OkHttpClient.Builder()
.connectTimeout(30, TimeUnit.SECONDS)
.writeTimeout(30, TimeUnit.SECONDS)
.readTimeout(30, TimeUnit.SECONDS)
.build();
public static <S> S createServiceSample(Class<S> serviceClass) {
Retrofit.Builder builder =
new Retrofit.Builder()
.client(okHttpClient)
.addCallAdapterFactory(RxJava2CallAdapterFactory.create())
.addConverterFactory(GsonConverterFactory.create());
builder.baseUrl(BASE_URL);
Retrofit retrofit = builder.build();
return retrofit.create(serviceClass);
}
}
Run Code Online (Sandbox Code Playgroud)
和我的 Api 接口 …
我使用的是Android Studio 4.0.1。当我尝试生成程序的调试版本时,出现以下错误。(生成发布版本没问题!)
创建调试版本
错误
条目名称“javax/annotation/CheckReturnValue.java”发生冲突
构建.gradle
apply plugin: 'com.android.application'
apply plugin: 'com.google.gms.google-services'
apply plugin: 'com.google.firebase.crashlytics'
//apply plugin: 'com.google.firebase.firebase-perf'
android {
compileSdkVersion 28
defaultConfig {
applicationId "ai"
minSdkVersion 19
targetSdkVersion 28
versionCode 6
versionName "0.3.1"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
vectorDrawables.useSupportLibrary = true
multiDexEnabled true
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
debug {
applicationIdSuffix '.dev'
}
}
dataBinding {
enabled = true
}
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'androidx.appcompat:appcompat:1.0.0'
implementation 'androidx.constraintlayout:constraintlayout:1.1.3' …Run Code Online (Sandbox Code Playgroud)