【问题标题】:How to fix weird Designer view errors?如何修复奇怪的设计师视图错误?
【发布时间】:2019-09-21 17:13:35
【问题描述】:

自从我更新到以 android Pie 为目标后,我在设计器视图中遇到了这个奇怪的错误,它似乎影响了 support.v7 包。 经过一段时间尝试自己解决并在谷歌上搜索问题,我仍然无法解决它。

构建工作正常,但没有设计师看到 UI 的变化很麻烦

设计器错误截图:

我已尝试返回 Oreo 版本并重新下载所有软件包以查看是否可以解决问题,但没有成功。

<!--Removed TextView and similar component information to reduce lines-->
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    android:orientation="vertical"
    android:layout_width="match_parent"
    android:layout_height="match_parent">
    <android.support.v7.widget.Toolbar
        android:id="@+id/toolbar"
        app:title="ITM"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:minHeight="?attr/actionBarSize"
        android:background="?attr/colorPrimary"
        android:elevation="4dp"
        android:theme="@style/ThemeOverlay.AppCompat"/>
    <!--Main View-->
    <ScrollView
        android:layout_weight="1"
        android:layout_width="match_parent"
        android:layout_height="match_parent">
        <android.support.v7.widget.GridLayout
            app:columnCount="2"
            app:orientation="horizontal"
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:padding="20dp">
            <android.support.v7.widget.GridLayout
                app:columnCount="2"
                app:orientation="horizontal"
                android:layout_width="match_parent"
                android:layout_height="match_parent"
                app:layout_columnSpan="2"
                android:layout_marginLeft="20dp"
                android:layout_marginRight="20dp">
                <TextView/>
                <TextView/>
                <TextView/>
                <TextView/>
                <TextView/>
                <TextView/>
                <TextView/>
                <TextView/>
                <TextView/>
            </android.support.v7.widget.GridLayout>
            <View/>
            <TextView/>
            <Switch/>
            <TextView/>
            <TextView />
            <Switch/>
            <TextView/>
            <TextView/>
            <Switch/>
            <TextView/>
        </android.support.v7.widget.GridLayout>
    </ScrollView>
<!--Only part that shows is here-->
    <LinearLayout
        android:orientation="vertical"
        android:layout_width="match_parent"
        android:layout_height="wrap_content">
        <TextView/>
        <Button/>
    </LinearLayout>
</LinearLayout>

【问题讨论】:

  • 请在此处添加整个堆栈跟踪
  • 不确定堆栈跟踪是什么
  • 你有两张截图显示了它的一部分,把整个错误信息复制粘贴到这里。
  • 经过进一步研究,我发现它很可能来自设计器 API 选择器——但选择器只有 API 26(而不是 28),没有别的。而且我不知道如何添加更多
  • 你能不能更具体地描述一下,现在什么问题?我运行你的代码,它运行良好

标签: android xaml xamarin package android-support-library


【解决方案1】:

在我放弃在 Visual Studio 2017 上修复它之后,我发现安装 2019 版本完全解决了这个问题。

他们强迫你使用最新版本有点难过,但这是我能找到的唯一可行的选择

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2020-02-22
    • 1970-01-01
    • 2020-11-29
    • 1970-01-01
    • 2021-04-21
    • 1970-01-01
    • 1970-01-01
    • 2019-08-23
    相关资源
    最近更新 更多