(Android) Ошибки рендеринга при смене темы на Material.light - PullRequest
0 голосов
/ 23 сентября 2018

Здравствуйте, я следовал некоторым руководствам Android в YouTube, и в предварительном просмотре вкладки дизайна, я получаю следующие ошибки

enter image description here

Однако,проблема в том, что я не получил ни одной из этих ошибок в теме «Apptheme».Но когда я изменил тему на Material.light, внезапно появились эти ошибки.

Вот мой код content_main.xml

<?xml version="1.0" encoding="utf-8"?>
<android.support.constraint.ConstraintLayout 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:id="@+id/constraintLayout"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    app:layout_behavior="@string/appbar_scrolling_view_behavior"
    tools:context=".MainActivity"
    tools:showIn="@layout/activity_main">

    <TextView
        android:id="@+id/textView"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_marginBottom="234dp"
        android:layout_marginLeft="150dp"
        android:layout_marginStart="150dp"
        android:text="Hi"
        app:layout_constraintBottom_toBottomOf="parent"
        app:layout_constraintStart_toStartOf="parent" />
</android.support.constraint.ConstraintLayout>

А вот мой код styles.xml.

<resources>

    <!-- Base application theme. -->
    <style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar">
        <!-- Customize your theme here. -->
        <item name = "coordinatorLayoutStyle">@style/Widget.Support.CoordinatorLayout</item>
        <item name="colorPrimary">@color/colorPrimary</item>
        <item name="colorPrimaryDark">@color/colorPrimaryDark</item>
        <item name="colorAccent">@color/colorAccent</item>
    </style>

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

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

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

</resources>

Какова возможная причина возникновения этих проблем при изменении темы на Material.light?

1 Ответ

0 голосов
/ 23 сентября 2018

эта ошибка отсутствующие атрибуты вы можете использовать ее в xml

 <LinearLayout 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"
    android:orientation="vertical"
</LinearLayout>
...