1, 昨天的成就:
a) 完成的任务:登陆界面,注册界面
b) 所花时间:4h
c) 还剩余2h
2, 遇到的困难:
a) 跳转时,页面设置需要多连接
3, 今天的任务:
a) 设置主页面
b) 实现瀑布流
1 package com.example.a13313.瀑布流; 2 3 import android.graphics.Rect; 4 import android.support.annotation.NonNull; 5 import android.support.v7.app.AppCompatActivity; 6 import android.os.Bundle; 7 import android.support.v7.widget.RecyclerView; 8 import android.support.v7.widget.StaggeredGridLayoutManager; 9 import android.view.View; 10 import android.widget.Toast; 11 12 import com.example.a13313.R; 13 14 public class PuRecycleViewActivity extends AppCompatActivity { 15 private RecyclerView mRvPu; 16 @Override 17 protected void onCreate(Bundle savedInstanceState) { 18 super.onCreate(savedInstanceState); 19 setContentView(R.layout.activity_pu_recycle_view); 20 mRvPu=(RecyclerView) findViewById(R.id.rv_pu); 21 mRvPu.setLayoutManager(new StaggeredGridLayoutManager(2,StaggeredGridLayoutManager.VERTICAL)); 22 mRvPu.addItemDecoration(new MyDecoration()); 23 mRvPu.setAdapter(new StaggeredGridAdapter(PuRecycleViewActivity.this, new StaggeredGridAdapter.OnItemClickListener() { 24 @Override 25 public void onClick(int pos) { 26 Toast.makeText(PuRecycleViewActivity.this,"click:"+pos,Toast.LENGTH_SHORT).show(); 27 } 28 })); 29 } 30 class MyDecoration extends RecyclerView.ItemDecoration{ 31 @Override 32 public void getItemOffsets(@NonNull Rect outRect, @NonNull View view, @NonNull RecyclerView parent, @NonNull RecyclerView.State state) { 33 super.getItemOffsets(outRect, view, parent, state); 34 int gap= getResources().getDimensionPixelSize(R.dimen.dividerHeight2); 35 36 outRect.set(gap,gap,gap,gap); 37 } 38 } 39 }