我正在尝试禁用所有声音效果,尤其是当一个项目被聚焦但没有任何成功时。
我试过设置
<item name="android:soundEffectsEnabled">false</item>
Run Code Online (Sandbox Code Playgroud)
在主应用程序主题中, RecyclerView 和 RecyclerView 项目但声音效果仍然有效。我以前使用过 ListView 并且使用此选项正确禁用了声音效果(可能是因为它使用了一个selected属性而不是依赖于焦点)。
我也可以通过调用完全禁用系统声音,mAudioManager.adjustStreamVolume(AudioManager.STREAM_SYSTEM, AudioManager.ADJUST_MUTE, 0)但这不适用于实现固定音量策略的设备。
重现步骤:
即使设置soundEffectsEnabled为false,您也会听到声音效果
更新: 一个带有基本 RecyclerView 的示例应用程序来重现问题
使用@Relation 注释。我可以使用以下方法查询一对多关系:
@Dao
public interface PostDao {
@Query("SELECT * FROM post")
List<PostWithComments> getPostWithComments();
}
Run Code Online (Sandbox Code Playgroud)
这里是实体
@Entity
public class Post {
@PrimrayKey
private int id;
private String title;
private String content;
}
@Entity
public class Comment {
@PrimrayKey
private int id;
private int post_id;
private String content;
private String status;
}
public class PostWithComments {
@Embedded
public Post post;
@Relation(parentColumn = "id", entityColumn = "post_id", entity = Comment.class)
public List<Comment> comments;
}
Run Code Online (Sandbox Code Playgroud)
我想得到所有有评论的帖子,status = approved但我不确定房间是如何处理的。我尝试了以下方法:
@Dao
public interface PostDao …Run Code Online (Sandbox Code Playgroud)