Все, что начинается с android: есть ошибка или предупреждение в файлах xml

Мой проект строится правильно, но я не могу увидеть предварительный просмотр пользовательского интерфейса и всех атрибутов, начиная с android: либо выделены красным цветом, и указано, что не удается разрешить символ. А также есть ошибка, которая говорит

One or more layouts are missing the layout_width or layout_height attributes. These are required in most layouts.

Но я проверил все файлы xml вручную, и нет макета без высоты и ширины. Пожалуйста, предложите мне кое-что.

P.S. Я пробовал перестроить, очистить и аннулировать кеш и перезапустить.

<?xml version = "1.0" encoding = "utf-8"?>
<LinearLayout
 xmlns:android = "http://schemas.android.com/apk/res/android"
    xmlns:app = "http://schemas.android.com/apk/res-auto"
    android:layout_width = "match_parent"
    android:layout_height = "match_parent"
    android:background = "#F7F9FE"
    android:orientation = "vertical">

    <RelativeLayout
        android:layout_width = "match_parent"
        android:layout_height = "?actionBarSize"
        android:background = "@color/white"
        android:elevation = "@dimen/_10sdp"
        android:orientation = "horizontal">

        <TextView
            android:layout_width = "match_parent"
            android:layout_height = "wrap_content"
            android:layout_weight = "1"
            android:gravity = "center"
            android:padding = "@dimen/_10sdp"
            android:text = "Help"
            android:textSize = "21sp"
            android:textStyle = "bold" />

        <ImageView
            android:id = "@+id/iv_close_help"
            android:layout_width = "?actionBarSize"
            android:layout_height = "?actionBarSize"
            android:layout_alignParentRight = "true"
            android:padding = "@dimen/_15sdp"
            android:src = "@drawable/ic_nav_close" />

    </RelativeLayout>

    <android.support.v7.widget.CardView
        android:id = "@+id/main_card_view"
        android:layout_width = "match_parent"
        android:layout_height = "wrap_content"
        android:layout_margin = "@dimen/_16sdp"
        android:elevation = "@dimen/_10sdp"
        app:cardCornerRadius = "8dp">

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

            <ImageView
                android:layout_width = "@dimen/_40sdp"
                android:layout_height = "@dimen/_40sdp"
                android:layout_marginTop = "@dimen/_20sdp"
                android:background = "@drawable/bg_help_call"
                android:padding = "@dimen/_10sdp"
                android:src = "@drawable/ic_call" />

            <TextView
                android:layout_width = "match_parent"
                android:layout_height = "wrap_content"
                android:gravity = "center"
                android:paddingTop = "@dimen/_20sdp"
                android:text = "@string/for_any_queries_kindly_call_us_on"
                android:textColor = "@color/text_gray"
                android:textSize = "15sp" />


            <TextView
                android:layout_width = "match_parent"
                android:layout_height = "wrap_content"
                android:gravity = "center"
                android:paddingBottom = "@dimen/_20sdp"
                android:paddingTop = "@dimen/_8sdp"
                android:text = "8000 1111 1111"
                android:textSize = "17sp"
                android:textStyle = "bold" />


            <TextView
                android:id = "@+id/tv_make_call"
                style = "@style/RobotoMediumStyle"
                android:layout_width = "match_parent"
                android:layout_height = "wrap_content"
                android:background = "#FAFAFA"
                android:gravity = "center"
                android:paddingBottom = "@dimen/_8sdp"
                android:paddingEnd = "@dimen/_10sdp"
                android:paddingTop = "@dimen/_8sdp"
                android:text = "Call"
                android:textColor = "@color/text_green"
                android:textSize = "16sp"
                android:textStyle = "bold"
                app:layout_constraintEnd_toEndOf = "parent" />

        </LinearLayout>
    </android.support.v7.widget.CardView>

    <android.support.v7.widget.CardView
        android:layout_width = "match_parent"
        android:layout_height = "wrap_content"
        android:layout_marginLeft = "@dimen/_16sdp"
        android:layout_marginRight = "@dimen/_16sdp"
        android:elevation = "@dimen/_10sdp"
        app:cardCornerRadius = "8dp">

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

            <ImageView
                android:layout_width = "@dimen/_40sdp"
                android:layout_height = "@dimen/_40sdp"
                android:layout_marginTop = "@dimen/_20sdp"
                android:background = "@drawable/bg_help_call"
                android:padding = "@dimen/_10sdp"
                android:src = "@drawable/ic_email_help" />

            <TextView
                android:layout_width = "match_parent"
                android:layout_height = "wrap_content"
                android:gravity = "center"
                android:paddingTop = "@dimen/_20sdp"
                android:text = "@string/you_can_also_contact_via_email"
                android:textColor = "@color/text_gray"
                android:textSize = "15sp" />


            <TextView
                android:layout_width = "match_parent"
                android:layout_height = "wrap_content"
                android:gravity = "center"
                android:paddingBottom = "@dimen/_20sdp"
                android:paddingTop = "@dimen/_8sdp"
                android:text = "[email protected]"
                android:textSize = "17sp"
                android:textStyle = "bold" />


            <TextView
                android:id = "@+id/tv_make_mail"
                style = "@style/RobotoMediumStyle"
                android:layout_width = "match_parent"
                android:layout_height = "wrap_content"
                android:background = "#FAFAFA"
                android:gravity = "center"
                android:paddingBottom = "@dimen/_8sdp"
                android:paddingEnd = "@dimen/_10sdp"
                android:paddingTop = "@dimen/_8sdp"
                android:text = "@string/contact_us_email"
                android:textColor = "@color/text_green"
                android:textSize = "16sp"
                android:textStyle = "bold"
                app:layout_constraintEnd_toEndOf = "parent" />

        </LinearLayout>
    </android.support.v7.widget.CardView>

</LinearLayout>

Styles.xml:

<resources>

    <!-- Base application theme. -->
    <style name = "AppTheme" parent = "Theme.AppCompat.Light.NoActionBar">
        <!-- Customize your theme here. -->
        <item name = "colorPrimary">@color/colorPrimary</item>
        <item name = "colorPrimaryDark">@color/colorPrimaryDark</item>
        <item name = "colorAccent">@color/colorAccent</item>
        <item name = "searchViewStyle">@style/MySearchViewStyle</item>
        <item name = "android:homeAsUpIndicator">@drawable/ic_nav_back</item>
        <item name = "homeAsUpIndicator">@drawable/ic_nav_back</item>
    </style>

    <style name = "AppTheme.NoActionBar">
        <item name = "windowActionBar">false</item>
        <item name = "windowNoTitle">true</item>
    </style>

    <style name = "MySearchViewStyle" parent = "Widget.AppCompat.SearchView">
        <item name = "closeIcon">@drawable/ic_close_white</item>
    </style>

    <style name = "AppTheme.AppBarOverlay" parent = "ThemeOverlay.AppCompat.Dark.ActionBar" />

    <style name = "AppTheme.PopupOverlay" parent = "ThemeOverlay.AppCompat.Light" />

    <style name = "OtpFieldStyle">
        <item name = "android:maxLength">2</item>
        <item name = "android:gravity">center</item>
        <item name = "android:inputType">text</item>
        <item name = "android:cursorVisible">true</item>
    </style>

    <style name = "SignUpFieldStyle" parent = "RobotoMediumStyle">
        <!--<item name = "android:layout_marginRight">50dp</item>-->
        <!--<item name = "android:layout_marginLeft">50dp</item>-->

        <item name = "android:maxLines">1</item>
        <item name = "android:textColorHint">@color/warm_grey</item>
        <item name = "android:gravity">center</item>
    </style>

    <style name = "ToolbarStyle" parent = "@style/ThemeOverlay.AppCompat.ActionBar">
        <item name = "colorControlNormal">@color/white</item>
    </style>


    <style name = "RobotoBlackStyle">
        <item name = "android:fontFamily">@string/font_fontFamily_black</item>
        <item name = "android:textColor">@color/black_two</item>
    </style>

    <style name = "RobotoLightStyle">
        <item name = "android:fontFamily">@string/font_fontFamily_light</item>
    </style>

    <style name = "RobotoMediumStyle">
        <item name = "android:fontFamily">@string/font_fontFamily_medium</item>
    </style>

    <style name = "RatingBar" parent = "Theme.AppCompat">
        <item name = "colorControlNormal">@color/row_text_gray</item>
        <item name = "colorControlActivated">@color/rating_star_color</item>
    </style>


    <style name = "RatingBarSmall" parent = "Theme.AppCompat">
        <item name = "colorControlNormal">@color/rating_transparent</item>
        <item name = "colorControlActivated">@color/rating_star_golden</item>
    </style>

    <style name = "DashBoardImage" parent = "Theme.AppCompat">
        <item name = "android:layout_marginBottom">12dp</item>
        <item name = "android:layout_gravity">center</item>
    </style>


    <style name = "DashBoardText" parent = "Theme.AppCompat">
        <item name = "android:textSize">12sp</item>
        <item name = "android:layout_gravity">center_horizontal|bottom</item>
        <item name = "android:layout_marginBottom">20dp</item>
    </style>

    <style name = "DashBoardCard" parent = "Theme.AppCompat">
        <item name = "android:layout_marginBottom">18dp</item>
        <item name = "android:layout_marginEnd">18dp</item>
        <item name = "android:layout_marginStart">18dp</item>
        <item name = "android:layout_marginTop">18dp</item>
        <item name = "android:foreground">?android:attr/selectableItemBackground</item>
        <item name = "android:clickable">true</item>
    </style>

    <style name = "tabTheam" parent = "android:Widget">
        <item name = "tabIndicatorColor">?attr/colorAccent</item>
        <item name = "tabIndicatorHeight">2dp</item>
        <item name = "tabBackground">@drawable/tab_color_selector</item>
        <item name = "tabTextAppearance">@style/TextAppearance.Design.Tab</item>
        <item name = "tabSelectedTextColor">?android:textColorPrimary</item>
    </style>


    <style name = "button_style">
        <item name = "android:height">@dimen/_40sdp</item>
        <item name = "android:width">@dimen/pw_large_margin</item>
        <item name = "android:background">@drawable/bg_button_selector</item>
    </style>


    <style name = "noInputEdittext" parent = "Theme.AppCompat">
        <item name = "android:backgroundTint">@color/peacock_blue</item>
        <item name = "android:drawableEnd">@drawable/img_down_blue</item>
        <item name = "android:focusableInTouchMode">false</item>
        <item name = "android:inputType">none</item>
        <item name = "android:maxLines">1</item>
        <item name = "android:textSize">14sp</item>
    </style>

    <style name = "Toolbar.TitleText" parent = "TextAppearance.Widget.AppCompat.Toolbar.Title">
        <item name = "android:textSize">18sp</item>
    </style>

    <style name = "RadioButtonStyle" parent = "@android:style/Widget.CompoundButton.RadioButton">
        <item name = "android:button">@drawable/custom_btn_radio</item>
    </style>
</resources>

сколько макетов (файлов xml) у вас есть? и сколько элементов управления у вас внутри? внимательно проверьте все элементы управления в макете (файлы xml)

Farrokh 04.10.2018 12:48

просмотрел все файлы xml, убедился, что каждый из них имеет высоту и ширину, а также изменил? actionBarSize на? android: attr / actionBarSize. Тем не менее его ошибки выдачи. Теперь это дает новую ошибку: Ошибка: java.util.concurrent.ExecutionException: com.android.builder.internal.aapt.v2.Aapt2Exception: Ошибка AAPT2: подробности см. В журналах

Cassius 04.10.2018 13:47
Пользовательский скаляр GraphQL
Пользовательский скаляр GraphQL
Листовые узлы системы типов GraphQL называются скалярами. Достигнув скалярного типа, невозможно спуститься дальше по иерархии типов. Скалярный тип...
Как вычислять биты и понимать побитовые операторы в Java - объяснение с примерами
Как вычислять биты и понимать побитовые операторы в Java - объяснение с примерами
В компьютерном программировании биты играют важнейшую роль в представлении и манипулировании данными на двоичном уровне. Побитовые операции...
Поднятие тревоги для долго выполняющихся методов в Spring Boot
Поднятие тревоги для долго выполняющихся методов в Spring Boot
Приходилось ли вам сталкиваться с требованиями, в которых вас могли попросить поднять тревогу или выдать ошибку, когда метод Java занимает больше...
Полный курс Java для разработчиков веб-сайтов и приложений
Полный курс Java для разработчиков веб-сайтов и приложений
Получите сертификат Java Web и Application Developer, используя наш курс.
0
2
365
1

Ответы 1

Добавьте следующее пространство имен в родительский элемент: -

xmlns:android = "http://schemas.android.com/apk/res/android"

его уже там, на самом деле местами их два: xmlns: android = "schemas.android.com/apk/res/android" xmlns: app = "schemas.android.com/apk/res-auto"

Cassius 04.10.2018 12:43

Конечно, я подумал, но вопрос в том, сколько? эта ошибка присутствует во всех них. Я добавлю 1 из них и тоже поделюсь своим файлом стиля. 1 мин, пожалуйста.

Cassius 04.10.2018 12:46

Проверьте сейчас, пожалуйста.

Cassius 04.10.2018 12:51

Попробуйте синхронизировать проект. Если это не сработает, попробуйте старый добрый System Restart.

rohiththammaiah 04.10.2018 12:56

Пробовал также синхронизацию, надеюсь, перезагрузка системы сработает. Дай мне несколько минут.

Cassius 04.10.2018 13:02

Проверьте свой файл стилей. Может быть, что-то внутри вызывает проблему

rohiththammaiah 04.10.2018 13:23

Другие вопросы по теме