gpt4 book ai didi

android - RecyclerView 显示为灰色框,其名称位于中心。对于已实现的音频可视化器 View 也是如此

转载 作者:行者123 更新时间:2023-12-03 03:57:12 29 4
gpt4 key购买 nike

Here一张图片可以更好地显示我遇到的问题...


大约一周前,我从 here 实现了一个音乐 Viusalizer .
我注意到它没有正确显示,因为它显示为一个灰色窗口(见上图),但考虑到它不是原生插件,我没有考虑太多。

然后两天前我需要使用 RecyclerView,当我下载它时,它具有相同的“破损”外观(见上图)。当我看到这一点时,我就知道项目或 Android Studio 有问题。

在过去的几天里,我已经查看了我在互联网上可以找到的所有内容,并且我尝试了所有内容,从降级 sdk 编译版本到将 Android Studio 更新到最新版本,从"file"菜单。

this , this , this , this , this , this , thisthis是我找到并尝试过的所有东西,但到目前为止,没有任何帮助......

这是我的 Activity java 文件

package com.franchini.myapplication;

import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;

public class MainActivity extends AppCompatActivity {

@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
}
}


这是我的 Activity xml 文件
<?xml version="1.0" encoding="utf-8"?>
<android.support.constraint.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".MainActivity">

<com.gauravk.audiovisualizer.visualizer.BlastVisualizer
xmlns:custom="http://schemas.android.com/apk/res-auto"
android:id="@+id/blast"
android:layout_width="0dp"
android:layout_height="0dp"
android:layout_marginBottom="16dp"
custom:avColor="@color/av_dark_blue"
custom:avDensity="0.8"
custom:avSpeed="normal"
custom:avType="fill"
custom:layout_constraintBottom_toTopOf="@+id/textView"
custom:layout_constraintEnd_toEndOf="parent"
custom:layout_constraintStart_toStartOf="parent"
custom:layout_constraintTop_toTopOf="parent" />

<TextView
android:id="@+id/textView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Hello World!"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toTopOf="parent" />

<android.support.v7.widget.RecyclerView
android:layout_width="0dp"
android:layout_height="0dp"
android:layout_marginTop="16dp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.0"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/textView" />

</android.support.constraint.ConstraintLayout>

这是我的样式 xml 文件
<resources>

<!-- Base application theme. -->
<style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar">
<!-- Customize your theme here. -->
<item name="colorPrimary">@color/colorPrimary</item>
<item name="colorPrimaryDark">@color/colorPrimaryDark</item>
<item name="colorAccent">@color/colorAccent</item>
</style>

</resources>

这是我的 build.gradle (项目)文件
// Top-level build file where you can add configuration options common to all sub-projects/modules.

buildscript {
repositories {
google()
jcenter()

}
dependencies {
classpath 'com.android.tools.build:gradle:3.3.2'

// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}

allprojects {
repositories {
google()
jcenter()

}
}

task clean(type: Delete) {
delete rootProject.buildDir
}

这是我的 build.gradle (app) 文件
apply plugin: 'com.android.application'

android {
compileSdkVersion 28
defaultConfig {
applicationId "com.franchini.myapplication"
minSdkVersion 21
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.gauravk.audiovisualizer:audiovisualizer:0.9.1'

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:recyclerview-v7:28.0.0'
}

现在,这个问题似乎只出现在编辑器上,因为当我直接在 Android 上测试它时,它就像一个魅力......

谁能帮我解决这个问题?我错过了一些非常愚蠢的东西吗?

[编辑]:我想指出这个问题我没有任何错误......

最佳答案

我知道我发布这个有点晚了......
我真的不知道我做了什么修复它,但不知何故,当我在修补了一整天后构建项目时,编辑器中的 View 修复了,它们再次开始工作,正确显示......

关于android - RecyclerView 显示为灰色框,其名称位于中心。对于已实现的音频可视化器 View 也是如此,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/55559651/

29 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com