Android 在my.axml布局文件中找不到某些视图
我在activity类中发现编译错误,该类表示找不到edit_password ID以及同一.axml文件中的其他ID。有人知道为什么吗Android 在my.axml布局文件中找不到某些视图,android,android-layout,xamarin.android,Android,Android Layout,Xamarin.android,我在activity类中发现编译错误,该类表示找不到edit_password ID以及同一.axml文件中的其他ID。有人知道为什么吗 <android.support.design.widget.TextInputLayout android:layout_marginTop="5dp" android:layout_width="match_parent" android:layout_height="wrap_con
<android.support.design.widget.TextInputLayout
android:layout_marginTop="5dp"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@color/basic_button_background"
style="@style/Widget.MaterialComponents.TextInputLayout.OutlinedBox"
>
<android.support.design.widget.TextInputEditText
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:singleLine="true"
app:passwordToggleEnabled="true"
android:id="@+id/edit_password"
android:textSize="@dimen/margin_padding_size_medium"
android:privateImeOptions="@string/abc_action_mode_done"
/>
</android.support.design.widget.TextInputLayout>
保存.axml文件,清理并重建项目。然后它应该重新生成Resources.designer.cs文件,该文件应该包含您的Id定义。我找到了答案:
你是对的。我忘了添加您提到的链接:
xmlns:app="http://schemas.android.com/apk/res-auto"
但除此之外,我还必须使用android:inputType=textPassword,这样开关才能工作
非常感谢您的启发:我在搜索丢失的ID时找到了它们。我认为当.xml文件中出现问题时会发生这种情况,那么与该.xml文件相关的所有ID都将导致错误。当我在文件中有重复的标签时,这种情况发生了几次。我遇到了同样的错误问题是.xml文件中的问题是什么导致了这个错误:您能显示完整的.xml吗?你想念xmlns:app吗=http://schemas.android.com/apk/res-auto 在根布局中