【问题标题】:Layout doesn´t show on Android Studio preview 4.2 [duplicate]Android Studio 预览版 4.2 上不显示布局 [重复]
【发布时间】:2021-05-08 21:50:55
【问题描述】:

这是我的“fragment_criar_quiz”布局,应用运行良好,但在 Android Studio 中不显示布局预览。

我项目的其他布局也可以正常工作,我想知道为什么它只发生在这个上。

IDE 显示的 2 个错误,渲染问题和字符串索引超出范围:-1

请帮忙:)

<?xml version="1.0" encoding="utf-8"?>
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:padding="16dp"
tools:context=".fragment.CriarQuizFragment">

<LinearLayout
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:orientation="vertical">

    <TextView
        android:id="@+id/textCriarQuizTitulo"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:fontFamily="@font/montserrat_extra_bold"
        android:text="@string/criar_quiz"
        android:textAlignment="center"
        android:textSize="36sp" />

    <TextView
        android:id="@+id/textCriarQuizSubTitulo"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_marginTop="8dp"
        android:fontFamily="@font/montserrat_extra_bold"
        android:text="@string/passo_1_3"
        android:textAlignment="center"
        android:textColor="@android:color/black"
        android:textSize="40sp" />

    <ImageView
        android:id="@+id/imageCriarQuiz"
        android:layout_width="125dp"
        android:layout_height="125dp"
        android:layout_gravity="center"
        android:layout_marginTop="24dp"
        android:background="@drawable/retangulo_matriculado"
        android:src="@drawable/ic_imagem" />

    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_margin="8dp"
        android:gravity="center"
        android:orientation="horizontal">

        <ImageButton
            android:id="@+id/imageButtonCriarQuizCamara"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_gravity="center"
            android:layout_marginEnd="16dp"
            android:background="@drawable/retangulo_laranja"
            android:padding="10dp"
            android:src="@drawable/ic_camara" />

        <ImageButton
            android:id="@+id/imageButtonCriarQuizGaleria"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_gravity="center"
            android:layout_marginStart="16dp"
            android:background="@drawable/retangulo_laranja"
            android:padding="10dp"
            android:src="@drawable/ic_imagem" />
    </LinearLayout>

    <LinearLayout
        android:id="@+id/linearLayoutCriarQuiz"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_margin="16dp"
        android:gravity="center"
        android:orientation="vertical">

        <EditText
            android:id="@+id/editTextCriarQuizTitulo"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_marginBottom="16dp"
            android:autofillHints=""
            android:background="@drawable/borda_preta"
            android:ems="10"
            android:fontFamily="@font/montserrat_medium"
            android:hint="@string/titulo_do_quiz"
            android:inputType="text"
            android:padding="16dp"
            android:textSize="18sp" />

        <Spinner
            android:id="@+id/spinnerCriarQuizTemas"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:background="@drawable/borda_preta"
            android:fontFamily="@font/montserrat_medium"
            android:padding="4dp"
            android:spinnerMode="dialog"
            android:textSize="18sp" />

    </LinearLayout>

    <LinearLayout
        android:id="@+id/linearLayoutCriarQuiz2"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_margin="16dp"
        android:orientation="vertical"
        android:visibility="gone">

        <EditText
            android:id="@+id/editTextCriarQuizIntroTitulo"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_marginBottom="16dp"
            android:autofillHints=""
            android:background="@drawable/borda_preta"
            android:ems="10"
            android:fontFamily="@font/montserrat_medium"
            android:hint="@string/titulo_da_introducao"
            android:inputType="text"
            android:padding="16dp"
            android:textSize="18sp" />

        <EditText
            android:id="@+id/editTextCriarQuizIntroDescricao"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_marginBottom="16dp"
            android:autofillHints=""
            android:background="@drawable/borda_preta"
            android:ems="10"
            android:fontFamily="@font/montserrat_medium"
            android:hint="@string/descricao_do_quiz_resumo"
            android:inputType="textMultiLine"
            android:padding="16dp"
            android:textSize="18sp" />

        <EditText
            android:id="@+id/editTextCriarQuizIntroVideo"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:autofillHints=""
            android:background="@drawable/borda_preta"
            android:ems="10"
            android:fontFamily="@font/montserrat_medium"
            android:hint="@string/video_descritivo_link"
            android:inputType="text"
            android:padding="16dp"
            android:textSize="18sp" />

    </LinearLayout>

    <LinearLayout
        android:id="@+id/linearLayoutCriarQuiz3"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_margin="16dp"
        android:orientation="vertical"
        android:visibility="gone">


        <TextView
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_marginTop="16dp"
            android:layout_marginBottom="24dp"
            android:fontFamily="@font/montserrat_medium"
            android:text="@string/configuracao_da_pergunta"
            android:textAlignment="center"
            android:textSize="18sp" />

        <LinearLayout
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:background="@drawable/borda_preta"
            android:orientation="vertical"
            android:padding="16dp">

            <EditText
                android:id="@+id/editTextCriarQuizPerguntaID"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:layout_marginBottom="16dp"
                android:autofillHints=""
                android:background="@drawable/borda_preta"
                android:ems="10"
                android:enabled="false"
                android:fontFamily="@font/montserrat_medium"
                android:hint="@string/id_da_pergunta"
                android:inputType="text"
                android:padding="16dp"
                android:textSize="18sp" />

            <EditText
                android:id="@+id/editTextCriarQuizPerguntaTitulo"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:layout_marginBottom="16dp"
                android:autofillHints=""
                android:background="@drawable/borda_preta"
                android:ems="10"
                android:fontFamily="@font/montserrat_medium"
                android:hint="@string/titulo_pergunta"
                android:inputType="textMultiLine"
                android:padding="16dp"
                android:textSize="18sp" />

            <Spinner
                android:id="@+id/editTextCriarQuizPerguntaTipo"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:layout_marginBottom="24dp"
                android:background="@drawable/borda_preta"
                android:fontFamily="@font/montserrat_medium"
                android:padding="4dp"
                android:spinnerMode="dialog"
                android:textSize="18sp" />

            <EditText
                android:id="@+id/editTextCriarQuizPerguntaXP"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:layout_marginBottom="16dp"
                android:autofillHints=""
                android:background="@drawable/borda_preta"
                android:ems="10"
                android:fontFamily="@font/montserrat_medium"
                android:hint="@string/xp_da_pergunta"
                android:inputType="number"
                android:padding="16dp"
                android:textSize="18sp" />

        </LinearLayout>

        <TextView
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_marginTop="16dp"
            android:layout_marginBottom="24dp"
            android:fontFamily="@font/montserrat_medium"
            android:text="@string/opcoes_de_resposta"
            android:textAlignment="center"
            android:textSize="18sp" />

    </LinearLayout>

    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_marginTop="16dp"
        android:layout_marginBottom="16dp"
        android:orientation="horizontal">

        <androidx.appcompat.widget.AppCompatButton
            android:id="@+id/buttonCriarQuizAdicionarOpcao"
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:layout_marginEnd="16dp"
            android:layout_weight="0.5"
            android:background="@drawable/retangulo_azul"
            android:fontFamily="@font/montserrat_medium"
            android:padding="16dp"
            android:text="@string/adicionar_opcao"
            android:textColor="@android:color/white"
            android:visibility="gone" />

        <androidx.appcompat.widget.AppCompatButton
            android:id="@+id/buttonCriarQuizRemoverOpcao"
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:layout_weight="0.5"
            android:background="@drawable/retangulo_laranja_vermelho"
            android:fontFamily="@font/montserrat_medium"
            android:padding="16dp"
            android:text="@string/remover_opcao"
            android:textColor="@android:color/white"
            android:visibility="gone" />
    </LinearLayout>

    <androidx.appcompat.widget.AppCompatButton
        android:id="@+id/buttonCriarQuizDefinirSolucao"
        android:layout_width="match_parent"
        android:layout_height="0dp"
        android:layout_marginTop="16dp"
        android:layout_marginBottom="16dp"
        android:layout_weight="0.5"
        android:background="@drawable/retangulo_azul"
        android:fontFamily="@font/montserrat_medium"
        android:padding="16dp"
        android:text="@string/definir_solucao"
        android:textColor="@android:color/white"
        android:visibility="gone" />

    <androidx.appcompat.widget.AppCompatButton
        android:id="@+id/buttonCriarQuizNovaPergunta"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_marginTop="16dp"
        android:layout_marginBottom="24dp"
        android:background="@drawable/retangulo_ciano"
        android:fontFamily="@font/montserrat_medium"
        android:padding="16dp"
        android:text="@string/nova_pergunta"
        android:textColor="@android:color/white"
        android:visibility="gone" />

    <androidx.appcompat.widget.AppCompatButton
        android:id="@+id/buttonCriarQuizPassoAnterior"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_marginTop="16dp"
        android:layout_marginBottom="16dp"
        android:background="@drawable/retangulo_azul"
        android:fontFamily="@font/montserrat_medium"
        android:padding="16dp"
        android:text="@string/passo_anterior"
        android:textColor="@android:color/white"
        android:visibility="gone" />

    <androidx.appcompat.widget.AppCompatButton
        android:id="@+id/buttonCriarQuizAvancar"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:background="@drawable/retangulo_matriculado"
        android:fontFamily="@font/montserrat_medium"
        android:padding="16dp"
        android:text="@string/passo_seguinte"
        android:textColor="@android:color/white" />

</LinearLayout>

</ScrollView>

IDE PrintScreen

【问题讨论】:

标签: android xml layout


【解决方案1】:

解决方案-> 删除|**android:autofillhints=""**|来自编辑文本

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2016-04-02
    • 1970-01-01
    • 1970-01-01
    • 2018-11-20
    • 2022-09-22
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多