Android项目开发中遇到的问题记录

  1. Android 6.0 解决recyclerview 在 scrollview 中不能全部显示,高度不正常的问题。
<RelativeLayout
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:descendantFocusability="blocksDescendants">
            <!-- DEV NOTE: Outer wrapper relative layout is added intentionally to address issue
                 that only happens on Marshmallow & Nougat devices (API 23 & 24).
                 On marshmallow API 23, the "RecyclerView" `layout_height="wrap_content"` does NOT
                 occupy the height of all the elements added to it via adapter. The result is cut out
                 items that is outside of device viewport when it loads initially.
                 Wrapping "RecyclerView" with "RelativeLayout" fixes the issue on Marshmallow devices.
            -->
            <android.support.v7.widget.RecyclerView
                android:id="@+id/my_recycler_view"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                tools:listitem="@layout/row_list_item">

            </android.support.v7.widget.RecyclerView>

        </RelativeLayout>
  1. 当使用的图片控件为CircleImagview的时候,Glide设置placeholder会出现第一次加载图片失败,当你再次刷新的时候,才能展现出图片
   Glide.with(this).load(imgurl)
                .placeholder(R.drawable.default_photo)
                .diskCacheStrategy(DiskCacheStrategy.ALL)
                .into(new SimpleTarget<GlideDrawable>() {
                    @Override
                    public void onResourceReady(GlideDrawable resource, GlideAnimation<? super GlideDrawable> glideAnimation) {
                        mCivUserPhoto.setImageDrawable(resource);
                    }
                });
最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容

  • Android 自定义View的各种姿势1 Activity的显示之ViewRootImpl详解 Activity...
    passiontim阅读 173,466评论 25 708
  • afinalAfinal是一个android的ioc,orm框架 https://github.com/yangf...
    passiontim阅读 15,568评论 2 45
  • 内容抽屉菜单ListViewWebViewSwitchButton按钮点赞按钮进度条TabLayout图标下拉刷新...
    皇小弟阅读 46,901评论 22 665
  • 要成为温暖的人第一步,要尽量记得与这个人有关的细节~最能打动人的,是与ta息息相关的事物
    文露婷阅读 274评论 0 0
  • 作为一部超级军事大片,无论是制作上的完成度,还是对故事节奏的把控,以及对人物角色的刻画,都是上乘水准。作为...
    夜泊临客阅读 433评论 0 1