相关疑难解决方法(0)

Android Studio布局编辑器无法呈现自定义视图

在Android Studio中,布局编辑器无法在xml中预览自定义视图.

很简单的例子:

public class MyCustomView extends FrameLayout {
    public MyCustomView(Context context) {
        super(context);
    }

    public MyCustomView(Context context, AttributeSet attrs) {
        super(context, attrs);
    }

    public MyCustomView(Context context, AttributeSet attrs, int defStyle) {
        super(context, attrs, defStyle);
    }
}
Run Code Online (Sandbox Code Playgroud)

 

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:orientation="horizontal">

    <com.myprojectxxx.view.MyCustomView
        android:layout_width="48dp"
        android:layout_height="48dp" />

</LinearLayout>
Run Code Online (Sandbox Code Playgroud)

Android Studio总是说,

渲染问题

找不到以下类:

  • com.myprojectxxx.view.MyCustomView(修复构建路径,创建类)

提示:尝试构建项目

当然,我有那门课.如果我单击"创建类",它会抱怨同一个类已经存在.如果我重建该项目,没有任何改变.

而且,是的,该项目在我的Android设备上运行良好.此外,它在Eclipse ADT中呈现得非常好.但是,在Android Studio中,它总是说"CLASSES可能无法找到".

Android Studio无法使用自定义视图预览xml文件?这有什么问题?

java android android-custom-view android-layout android-studio

46
推荐指数
5
解决办法
2万
查看次数

Android Studio xml预览问题无法初始化编辑器

更新 android studio dolphin后,我的旧项目 xml 预览不显示视图。有人面临同样的问题吗?并已完成解决方案,请在这里分享。它运行得很好,但预览不起作用。

我做了什么尝试?

  • 文件 -> 使现金无效/重新启动
  • 删除 build 、 idea 、 gradle 文件夹
  • 重启PC和android studio

但这些都没有解决我的问题。

错误图像 不显示

android android-studio android-studio-dolphin

13
推荐指数
2
解决办法
6492
查看次数

将 Android Studio 更新到 Dolphin 更新后,它不显示布局预览

我已将我的 Android studio 更新到新的 Dolphin 2021.3.1 版本。但更新 Android studio 后布局预览不起作用。它显示空白屏幕。如果有人解决这个问题请帮我解决这个问题。这是问题的截图

android android-layout android-studio android-layout-editor android-studio-dolphin

5
推荐指数
1
解决办法
2411
查看次数