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) } } }
- Kotlin配置错误
- 无法find方法’com.android.build.gradle.api.BaseVariant.getOutputs()Ljava / util / List;’
- Android / Java:有没有一种方法来存储一个方法?
- 现有的方法来设置Android库模块的组件的UI风格?
- 在ViewHolder中使用kotlin-android-extensions
- 错误在http请求返回错误时处理UI线程
- 你如何声明一个使用Jackson XML的JsonTypeInfo.As.WRAPPER_OBJECT的多态字段?
- 为一个开源项目创建dummy Fabric Api键
- 作为运营商,我不清楚kotlin文档