zoukankan      html  css  js  c++  java
  • 2.14 GridRecyclerViewActivity

    GridRecyclerViewActivity

    package com.example.firstapp.recyclerview;
    
    import androidx.appcompat.app.AppCompatActivity;
    import androidx.recyclerview.widget.GridLayoutManager;
    import androidx.recyclerview.widget.RecyclerView;
    
    import android.graphics.Rect;
    import android.os.Bundle;
    import android.view.View;
    import android.widget.Toast;
    
    import com.example.firstapp.R;
    
    public class GridRecyclerViewActivity extends AppCompatActivity {
    
    
        private RecyclerView mRvGrid;
        @Override
        protected void onCreate(Bundle savedInstanceState) {
            super.onCreate( savedInstanceState );
            setContentView( R.layout.activity_grid_recycler_view );
            mRvGrid=findViewById( R.id.rv_grid );
            mRvGrid.setLayoutManager( new GridLayoutManager( GridRecyclerViewActivity.this,3 ) );//可以规定你一行想展示几个
            mRvGrid.setAdapter( new GridAdapter( GridRecyclerViewActivity.this, new GridAdapter.OnItemClickListener() {
                @Override
                public void onclick(int pos) {
                    Toast.makeText( GridRecyclerViewActivity.this, "click"+pos, Toast.LENGTH_SHORT ).show();
                }
            } ) );
        }
    }
  • 相关阅读:
    win10美化
    ubuntu wine QQ
    chromedriver@2.41.0 install: `node install.js`
    修改placeholder样式
    win7 烧 驱动
    CSS布局
    菜鸟教程首页
    CSS选择器
    break,continue和label语句
    for-in语句
  • 原文地址:https://www.cnblogs.com/dty602511/p/14913014.html
Copyright © 2011-2022 走看看