PaintActivity.java 文件源码

java
阅读 36 收藏 0 点赞 0 评论 0

项目:GitHub 作者:
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_sample);

    RecyclerView recyclerView = (RecyclerView) findViewById(R.id.main_recyclerview);
    // Workaround for dash path effect
    // https://code.google.com/p/android/issues/detail?id=29944
    if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.HONEYCOMB) {
        recyclerView.setLayerType(View.LAYER_TYPE_SOFTWARE, null);
    }

    SimpleAdapter adapter = new SimpleAdapter(this);
    LinearLayoutManager manager = new LinearLayoutManager(this);
    manager.setOrientation(OrientationHelper.VERTICAL);
    recyclerView.setLayoutManager(manager);
    recyclerView.setAdapter(adapter);

    Paint paint = new Paint();
    paint.setStrokeWidth(5);
    paint.setColor(Color.BLUE);
    paint.setAntiAlias(true);
    paint.setPathEffect(new DashPathEffect(new float[]{25.0f, 25.0f}, 0));
    recyclerView.addItemDecoration(new HorizontalDividerItemDecoration.Builder(this)
            .paint(paint)
            .showLastDivider()
            .build());
}
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号