小编Jai*_*Jai的帖子

膨胀 androidx.appcompat.widget.SearchView 时出错

我们在 Play 商店中收到有关 androidx.appcompat.widget.SearchView 膨胀异常的崩溃报告,在 OnCreateView 方法中我们以这种方式膨胀布局。

val binding = DataBindingUtil.inflate(inflater, R.layout.layout_class_groups, container, false)
Run Code Online (Sandbox Code Playgroud)

xml中的SearchView实现如下。

   <androidx.appcompat.widget.SearchView
            android:id="@+id/classGroupsSearchView"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:background="@color/white"
            android:theme="@style/SearchViewStyle"
            app:iconifiedByDefault="false" />
Run Code Online (Sandbox Code Playgroud)

我也为 SearchView 使用了自定义样式。

<style name="SearchViewStyle" parent="Widget.AppCompat.Light.SearchView">
    <item name="android:textSize">16sp</item>
</style>
Run Code Online (Sandbox Code Playgroud)

我们在测试时无法复制此崩溃,那么我该如何修复它呢?

data-binding android kotlin inflate-exception searchview

6
推荐指数
0
解决办法
309
查看次数

Android房间:实体和Pojos必须有一个可用的公共构造函数

实体和Pojos必须具有可用的公共构造函数.您可以拥有一个空构造函数或其参数与字段匹配的构造函数(按名称和类型)

我将房间整合到我现有的项目中.在使用@Entity标记注释实现Parcelable的POJO并进行必要的更改时,会收到此错误.我已经有一个空的构造函数.任何帮助,将不胜感激.

@Entity(tableName = "Departments")
public class Department implements Parcelable {

    @PrimaryKey(autoGenerate = true)
    private Integer primaryId;
    private Integer id;
    private String departmentName;
    private String logoUrl;
    @Embedded
    private ArrayList<Template> templateList;

    public Department() {
    }

    protected Department(Parcel in) {
        this.primaryId = (Integer) in.readSerializable();
        this.departmentName = in.readString();
        this.logoUrl = in.readString();
        this.id = (Integer) in.readSerializable();
        this.templateList = in.createTypedArrayList(Template.CREATOR);
    }

    public static final Creator<Department> CREATOR = new Creator<Department>() {
        @Override
        public Department createFromParcel(Parcel in) {
            return new Department(in);
        }

        @Override
        public Department[] newArray(int size) …
Run Code Online (Sandbox Code Playgroud)

entity parcelable android-room

4
推荐指数
2
解决办法
4616
查看次数

如何从CloudWatch日志中过滤掉重复值?

我的 Android 应用程序日志位于 CloudWatch 中。我正在跟踪的一个事件就是提供这样的数据。

使用“count_distinct”时,它给出的计数为 242,而使用“count”时,它给出的计数为 243。因此,存在一个重复条目。

我也有 id 字段。我想这可能会重复。我怎样才能过滤掉它?

android amazon-web-services amazon-cloudwatch amazon-cloudwatchlogs aws-cloudwatch-log-insights

3
推荐指数
1
解决办法
1万
查看次数

Lombok 不适用于 Android Studio 3.4

将 android studio 更新到 3.4 后,我遇到了 lombok 插件的问题。尽管在模型类内部,注释被识别并正确显示,但在活动中我使用的所有 getter 和 setter 函数都无法识别。我也可以构建项目,但在所有活动中,所有 getter 和 setter 函数都以红色显示。任何帮助深表感谢。

我尝试为 android-studio 启用注释处理器。我使用 lombok 作为网站中给出的依赖项,带有注释处理器。Gradle 版本是 3.4.0。

annotation-processing lombok android-studio-3.4 android-gradle-3.4.0

2
推荐指数
1
解决办法
3916
查看次数