我的程序运行正常,但编译器中显示此错误。如何解决?
在 Google 上找不到有关此问题的答案,我检查了很多次。
Activity 主
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="@+id/mainLayout"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".MainActivity">
<!-- username-->
<com.google.android.material.textfield.TextInputLayout
android:id="@+id/username_TIL"
android:layout_width="250dp"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:layout_marginTop="100dp"
android:elevation="2dp">
<com.google.android.material.textfield.TextInputEditText
android:id="@+id/username_TIET"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:hint="@string/username" />
</com.google.android.material.textfield.TextInputLayout>
<!-- password-->
<com.google.android.material.textfield.TextInputLayout
android:id="@+id/password_TIL"
android:layout_width="250dp"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:layout_marginTop="20dp"
android:layout_below="@id/username_TIL">
<com.google.android.material.textfield.TextInputEditText
android:id="@+id/password_TIET"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:hint="password"/>
</com.google.android.material.textfield.TextInputLayout>
<!-- confirmPassword-->
<com.google.android.material.textfield.TextInputLayout
android:id="@+id/confirmPassword_TIL"
android:layout_width="250dp"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:layout_marginTop="20dp"
android:layout_below="@id/password_TIL">
<com.google.android.material.textfield.TextInputEditText
android:id="@+id/confirmPassword_TIET"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:hint="@string/confirm_password"/>
</com.google.android.material.textfield.TextInputLayout>
<!-- SignIn-->
<androidx.appcompat.widget.AppCompatButton
android:id="@+id/signIn_BTN"
android:layout_width="100dp"
android:layout_height="wrap_content"
android:text="@string/sign_in"
android:textColor="@android:color/white"
app:cornerRadius="50dp"
android:elevation="2dp"
android:layout_below="@id/confirmPassword_TIL"
android:layout_marginTop="20dp"
android:layout_centerHorizontal="true"
android:background="@android:color/holo_blue_light"/>
</RelativeLayout>
MainActivity 中没有任何内容 - 已初始化
list 文件也没有添加任何额外内容。关于为什么会发生此错误的任何解释。另外还显示了一个错误。
E/InputTransport: ro.sf.lcd_density must be defined as a build property
最佳答案
我也遇到了同样的问题,但我的问题是因为屏幕密度。您可能需要修改可绘制文件夹中的图像或图标大小(如果有),然后生成副本到以下目录。
res/
drawable-xxxhdpi/
example.png
drawable-xxhdpi/
example.png
drawable-xhdpi/
example.png
drawable-hdpi/
example.png
drawable-mdpi/
example.png
有关更多信息,请阅读 here
关于java - 访问被拒绝发现属性“ro.sf.lcd_密度,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/57653209/