我的XML代码不断破坏我的应用程序,它出了什么问题



我不知道它出了什么问题,但它只是破坏了我的应用程序,如果你需要的话,我稍后会发布我的java代码,因为堆栈现在不允许我这么做。当我评论EditTexts时,它工作得很好,但不需要,所以我认为有问题

<?xml version="1.0" encoding="utf-8"?>
<androidx.core.widget.NestedScrollView
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">
<EditText
android:id="@+id/A"
android:layout_height="wrap_content"
android:layout_width="match_parent"
android:inputType="number"/>
<EditText
android:id="@+id/B"
android:layout_height="wrap_content"
android:layout_width="match_parent"
android:inputType="number"/>
<EditText
android:id="@+id/C"
android:layout_height="wrap_content"
android:layout_width="match_parent"
android:inputType="number"/>
<Button
android:layout_width="match_parent"
android:layout_height="match_parent"
android:id="@+id/calculate"
android:text="calculate"
/>
<TextView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:id="@+id/output"
/>

</androidx.core.widget.NestedScrollView>

(Nested(ScrollView只能有一个直接子级。基本上,ScrollView负责滚动,但只需要一个元素即可滚动。

<?xml version="1.0" encoding="utf-8"?>
<androidx.core.widget.NestedScrollView
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">
<LinearLayout
android:layout_height="wrap_content"
android:layout_width="match_parent"
android:orientation="vertical">
<EditText
android:id="@+id/A"
android:layout_height="wrap_content"
android:layout_width="match_parent"
android:inputType="number"/>
<EditText
android:id="@+id/B"
android:layout_height="wrap_content"
android:layout_width="match_parent"
android:inputType="number"/>
<EditText
android:id="@+id/C"
android:layout_height="wrap_content"
android:layout_width="match_parent"
android:inputType="number"/>
<Button
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:id="@+id/calculate"
android:text="calculate" />
<TextView
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:id="@+id/output" />
</LinearLayout >
</androidx.core.widget.NestedScrollView>

最新更新