在Android模拟器中未显示的视图

时间:2019-06-18 13:47:05

标签: android android-studio

我正在尝试创建一个简单的App,但是遇到了以下问题。设计时,我的所有视图都已显示在预览中。但是,当我通过物理设备运行APP时,某些视图消失了。我使用的物理设备的android更新版本为8.1.0,因为我的PC处理器是AMD ryzen,所以我不能使用android studio模拟器,目标SDK是26。

请注意,当我将android studio更新为3.5 canary版本时,所有这些都发生了。

我尝试更改SDK,但收到一些错误。

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout 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=".GPA_4_1">

<LinearLayout
    android:id="@+id/FirstCourse"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:layout_marginTop="40dp"
    android:orientation="horizontal">

    <TextView
        android:id="@+id/Result_4_1"
        android:layout_width="0dp"
        android:layout_height="match_parent"
        android:layout_weight="1"
        android:paddingLeft="5dp"
        android:paddingRight="5dp">

    </TextView>

    <Spinner
        android:id="@+id/spinner_4_1"
        android:layout_width="0dp"
        android:layout_height="match_parent"
        android:layout_weight="1"
        android:paddingLeft="5dp"
        android:paddingRight="5dp">

    </Spinner>

    <EditText
        android:id="@+id/CreditHour_1"
        android:layout_width="0dp"
        android:layout_height="match_parent"
        android:layout_weight="1"
        android:inputType="number"
        android:paddingLeft="5dp"
        android:paddingRight="5dp">

    </EditText>


</LinearLayout>

<LinearLayout
    android:id="@+id/SecondCourse"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:layout_below="@+id/FirstCourse"
    android:layout_marginTop="20dp"
    android:orientation="horizontal">

    <TextView
        android:id="@+id/Result_4_2"
        android:layout_width="0dp"
        android:layout_height="match_parent"
        android:layout_weight="1"
        android:paddingLeft="5dp"
        android:paddingRight="5dp">

    </TextView>

    <Spinner
        android:id="@+id/spinner_4_2"
        android:layout_width="0dp"
        android:layout_height="match_parent"
        android:layout_weight="1"
        android:paddingLeft="5dp"
        android:paddingRight="5dp">

    </Spinner>

    <EditText
        android:id="@+id/CreditHour_2"
        android:layout_width="0dp"
        android:layout_height="match_parent"
        android:layout_weight="1"
        android:inputType="number"
        android:paddingLeft="5dp"
        android:paddingRight="5dp">

    </EditText>


</LinearLayout>

<LinearLayout
    android:id="@+id/ThirdCourse"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:layout_below="@+id/SecondCourse"
    android:layout_marginTop="20dp"
    android:orientation="horizontal">

    <TextView
        android:id="@+id/Result_4_3"
        android:layout_width="0dp"
        android:layout_height="match_parent"
        android:layout_weight="1"
        android:paddingLeft="5dp"
        android:paddingRight="5dp">

    </TextView>

    <Spinner
        android:id="@+id/spinner_4_3"
        android:layout_width="0dp"
        android:layout_height="match_parent"
        android:layout_weight="1"
        android:paddingLeft="5dp"
        android:paddingRight="5dp">

    </Spinner>

    <EditText
        android:id="@+id/CreditHour_3"
        android:layout_width="0dp"
        android:layout_height="match_parent"
        android:layout_weight="1"
        android:inputType="number"
        android:paddingLeft="5dp"
        android:paddingRight="5dp">

    </EditText>


</LinearLayout>

<LinearLayout
    android:id="@+id/ForthCourse"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:layout_below="@+id/ThirdCourse"
    android:layout_marginTop="20dp"
    android:orientation="horizontal">

    <TextView
        android:id="@+id/Result_4_4"
        android:layout_width="0dp"
        android:layout_height="match_parent"
        android:layout_weight="1"
        android:paddingLeft="5dp"
        android:paddingRight="5dp">

    </TextView>

    <Spinner
        android:id="@+id/spinner_4_4"
        android:layout_width="0dp"
        android:layout_height="match_parent"
        android:layout_weight="1"
        android:paddingLeft="5dp"
        android:paddingRight="5dp">

    </Spinner>

    <EditText
        android:id="@+id/CreditHour_4"
        android:layout_width="0dp"
        android:layout_height="match_parent"
        android:layout_weight="1"
        android:inputType="number"
        android:paddingLeft="5dp"
        android:paddingRight="5dp">

    </EditText>


</LinearLayout>

<LinearLayout
    android:id="@+id/FifthCourse"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:layout_below="@+id/ForthCourse"
    android:layout_marginTop="20dp"
    android:orientation="horizontal">

    <TextView
        android:id="@+id/Result_4_5"
        android:layout_width="0dp"
        android:layout_height="match_parent"
        android:layout_weight="1"
        android:paddingLeft="5dp"
        android:paddingRight="5dp">

    </TextView>

    <Spinner
        android:id="@+id/spinner_4_5"
        android:layout_width="0dp"
        android:layout_height="match_parent"
        android:layout_weight="1"
        android:paddingLeft="5dp"
        android:paddingRight="5dp">

    </Spinner>

    <EditText
        android:id="@+id/CreditHour_5"
        android:layout_width="0dp"
        android:layout_height="match_parent"
        android:layout_weight="1"
        android:inputType="number"
        android:paddingLeft="5dp"
        android:paddingRight="5dp">

    </EditText>

</LinearLayout>


<LinearLayout
    android:id="@+id/SixthCourse"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:layout_below="@+id/FifthCourse"
    android:layout_marginTop="20dp"
    android:orientation="horizontal">

    <TextView
        android:id="@+id/Result_4_6"
        android:layout_width="0dp"
        android:layout_height="match_parent"
        android:layout_weight="1"
        android:paddingLeft="5dp"
        android:paddingRight="5dp">

    </TextView>

    <Spinner
        android:id="@+id/spinner_4_6"
        android:layout_width="0dp"
        android:layout_height="match_parent"
        android:layout_weight="1"
        android:paddingLeft="5dp"
        android:paddingRight="5dp">

    </Spinner>

    <EditText
        android:id="@+id/CreditHour_6"
        android:layout_width="0dp"
        android:layout_height="match_parent"
        android:layout_weight="1"
        android:inputType="number"
        android:paddingLeft="5dp"
        android:paddingRight="5dp">

    </EditText>


</LinearLayout>

<LinearLayout
    android:id="@+id/SeventhCourse"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:layout_below="@+id/SixthCourse"
    android:layout_marginTop="20dp"
    android:orientation="horizontal">

    <TextView
        android:id="@+id/Result_4_7"
        android:layout_width="0dp"
        android:layout_height="match_parent"
        android:layout_weight="1"
        android:paddingLeft="5dp"
        android:paddingRight="5dp">

    </TextView>

    <Spinner
        android:id="@+id/spinner_4_7"
        android:layout_width="0dp"
        android:layout_height="match_parent"
        android:layout_weight="1"
        android:paddingLeft="5dp"
        android:paddingRight="5dp">

    </Spinner>

    <EditText
        android:id="@+id/CreditHour_7"
        android:layout_width="0dp"
        android:layout_height="match_parent"
        android:layout_weight="1"
        android:inputType="number"
        android:paddingLeft="5dp"
        android:paddingRight="5dp">

    </EditText>


</LinearLayout>

<LinearLayout
    android:id="@+id/EighthCourse"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:layout_below="@+id/SeventhCourse"
    android:layout_marginTop="20dp"
    android:orientation="horizontal">

    <TextView
        android:id="@+id/Result_4_8"
        android:layout_width="0dp"
        android:layout_height="match_parent"
        android:layout_weight="1"
        android:paddingLeft="5dp"
        android:paddingRight="5dp">

    </TextView>

    <Spinner
        android:id="@+id/spinner_4_8"
        android:layout_width="0dp"
        android:layout_height="match_parent"
        android:layout_weight="1"
        android:paddingLeft="5dp"
        android:paddingRight="5dp">

    </Spinner>

    <EditText
        android:id="@+id/CreditHour_8"
        android:layout_width="0dp"
        android:layout_height="match_parent"
        android:layout_weight="1"
        android:inputType="number"
        android:paddingLeft="5dp"
        android:paddingRight="5dp">

    </EditText>


</LinearLayout>


<TextView
    android:id="@+id/Result"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:layout_below="@id/EighthCourse"
    android:layout_marginTop="20dp"
    android:layout_marginBottom="20dp">

</TextView>

<Button
    android:id="@+id/Calculate"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:layout_below="@+id/Result">

</Button>

0 个答案:

没有答案