SwipeRefreshLayout和RecyclerView之间的差距
如何消除这两者之间的空隙? RecyclerView现在开始靠近屏幕的一半,从第一个元素到工具栏都有空白区域。 (只有当我添加足够的物品recyclerview开始顶部)。
我正在使用Kotlin和AnkoLayouts。
override fun createView(ui: AnkoContext): View = with(ui) { return relativeLayout { lparams(width = matchParent, height = matchParent) addItemButton = floatingActionButton { imageResource = android.R.drawable.ic_input_add }.lparams { margin = dip(10) alignParentBottom() alignParentEnd() alignParentRight() gravity = Gravity.BOTTOM or Gravity.END } swipeRefreshLayout = swipeRefreshLayout { rv = recyclerView { layoutManager = LinearLayoutManager(context, LinearLayoutManager.VERTICAL, true) adapter = listAdapter lparams(width = matchParent, height = wrapContent) } }.lparams(width = matchParent, height = wrapContent) } }
通过在SwipeRefreshLayout中放置另一个布局解决了这个问题。
swipeRefreshLayout = swipeRefreshLayout { linearLayout { rv = recyclerView { layoutManager = LinearLayoutManager(context, LinearLayoutManager.VERTICAL, true) adapter = listAdapter lparams(width = matchParent, height = wrapContent) } } }
- Android的 – 如何使用Kotlin在SortTableView中设置ColumnComparator
- 意图在Android的webview中播放任何嵌入的视频
- compileReleaseKotlin失败,java.lang.ClassNotFoundException:com.sun.tools.javac.util.Context
- Kotlin和Android Databinding
- 如何摧毁片段?
- 在Kotlin Lambda中调用一个RxJava单身人士
- 如何在Kotlin中手动解析JSON?
- 如何使用改进发送请求到tt-rss api
- 嘲弄的对象仍在调用方法(Mockito + Kotlin)