草庐IT

items_rooms

全部标签

java - 通过 XML API 改造阅读列表<Item>

我正在尝试将Retrofit与SimpleXmlConverter结合使用以从我的API读取数据。我的类(class)评论看起来像:@RootclassComment{@ElementprivateStringtext;}我想从XML中读取评论列表:sampletextsampletext在我的界面中有一个方法:@GET("/lastcomments")ArrayListlastComments();但是当我调用lastComments()改造抛出:Causedby:retrofit.RetrofitError:java.lang.ClassCastException:libcore.

android - 数据绑定(bind) RecyclerView : Cannot find the setter for attribute 'app:items'

当我尝试竞标RecyclerView时出现此错误Error:(15,22)Cannotfindthesetterforattribute'app:items'withparametertypeandroid.databinding.ObservableArrayListonandroid.support.v7.widget.RecyclerView.这是我的代码:但是在UsersViewModel我已经有一个公共(public)用户数组packagecom.toong.databindingdemo.recycler;importandroid.databinding.BaseObse

Android: Horizo​​ntalScrollView in a ListView row Item, focus issue

我有一个ListView,每个项目都有一个包含Horizo​​ntalScrollView的布局。问题是,当用户单击或触摸列表项时,我无法让整个列表项成为焦点。我该如何解决这个问题?谢谢编辑:Horizo​​ntalScrollView看起来像这样: 最佳答案 好的,伙计们,我知道了。在LinearLayout包装我的Horizo​​ntalScrollView我添加了以下属性:android:descendantFocusability="blocksDescendants"所以Horizo​​ntalScrollView没有获得

Android Room Persistence Library Proguard 配置

我正在使用AndroidRoomPersistenceLibrary1.0.0-alpha5。使用ProGuard编译时出现以下错误。Warning:android.arch.persistence.room.paging.LimitOffsetDataSource:can'tfindsuperclassorinterfaceandroid.arch.util.paging.CountedDataSourceWarning:android.arch.persistence.room.paging.LimitOffsetDataSource:can'tfindreferencedclas

Android:simple_list_item_single_choice 不适用于 ArrayAdapter

在我的ListView中,我想通过单选来删除项目。为此,我将simple_list_item_single_choice与ArrayAdapter一起使用。它向我显示了我的ListView中的单选选项。但我无法点击该复选框。这是我的代码:ArrayListarray_list_title=mydb.getTitle();System.out.println(array_list_title);ArrayAdapterarrayAdapter=newArrayAdapter(this,android.R.layout.simple_list_item_single_choice,arra

android - 如何使用 Room 和 RxJava 插入数据?

db.activitiesDao().insertStep(step);这将返回臭名昭著的错误:java.lang.IllegalStateException:CannotaccessdatabaseonthemainthreadsinceitmaypotentiallylocktheUIforalongperiodoftime.我是RxJava的新手,不想使用AsyncTask。 最佳答案 尝试这样的事情。Observable.fromCallable(()->db.activitiesDao().insertStep(step)

android - 折叠工具栏布局 : Change menu item icon color when it is expanded

我在我的项目中使用CollapsingToolbarLayout。当CollapsingToolbarLayout展开时,默认情况下它是白色的(即在style.xmlandroid:textColorSecondary中定义)。我的问题:Iwanttochangemymenuitemiconcolor.这是我的代码:xml文件:主要Activity代码:AppBarLayoutappBarLayout=findViewById(R.id.appbar_layout);appBarLayout.addOnOffsetChangedListener(newAppBarLayout.OnOf

android - 带有 RxJava2 的 Android Room 中的交易

我的应用程序的一个要求是允许用户完成多个步骤,然后在完成后根据每个步骤中的条目将值写入数据库。UI中的每个步骤都可能有助于将需要写入数据库的操作。数据可能位于多个表中,并且属于这些表中的不同行。如果任何数据库操作失败,则整个操作应该失败。我最初考虑将所有数据加载到内存中,对其进行操作,然后简单地在每个可能的实体中调用更新方法(使用REPLACE的冲突策略),但内存中的数据量可能非常大.我认为我可以组装一个列表,其中显示中的每个fragment都提供一个或多个可完成项,然后在UI流结束时使用Completable.concat()按顺序执行这些项。它看起来像下面这样:Completabl

android - 我们如何在 ViewModel 中将 "assign"LiveData 从 Room 转移到 MutableLiveData

最近,我被下面的代码困住了。publicclassNoteViewModelextendsViewModel{privatefinalMutableLiveData>notesLiveData=newMutableLiveData();publicNoteViewModel(){LiveData>notesLiveDataFromRepository=NoteRepository.INSTANCE.getNotes();//HowcanI"assign"LiveDatafromRoom,toMutableLiveData?}}我想知道,如何将Room中的LiveData“分配”到Mut

android - Android 中的 simple_list_item_2

在使用simple_list_item_1创建了一些菜单(效果很好)后,我尝试用simple_list_item_2替换它,但我的系统抛出异常...现在我想知道如何为我的列表创建这样一个两个不同大小的行条目...初学者有什么陷阱吗?有人可以帮我解决我的(小!?)问题吗?我的代码是这样的:ListAdapterlistAdapter=newArrayAdapter(this,android.R.layout.simple_list_item_2,fileNames);setListAdapter(listAdapter);我的String[]fileNames存储所有要按升序显示的字符串