content: package travel.ithaka.android.horizontalpicker;
  
  import android.os.Bundle;
  import androidx.appcompat.app.AppCompatActivity;
  import androidx.recyclerview.widget.LinearSnapHelper;
  import androidx.recyclerview.widget.RecyclerView;
  import androidx.recyclerview.widget.SnapHelper;
  import android.view.View;
  import android.widget.TextView;
  import android.widget.Toast;
  
  import java.util.ArrayList;
  import java.util.List;
  
  import travel.ithaka.android.horizontalpickerlib.PickerLayoutManager;
  
  public class MainActivity extends AppCompatActivity {
      RecyclerView rv;
      PickerAdapter adapter;
  
      @Override
      protected void onCreate(Bundle savedInstanceState) {
          super.onCreate(savedInstanceState);
          setContentView(R.layout.activity_main);
          rv = (RecyclerView) findViewById(R.id.rv);
  
          PickerLayoutManager pickerLayoutManager = new PickerLayoutManager(this, PickerLayoutManager.HORIZONTAL, false);
          pickerLayoutManager.setChangeAlpha(true);
          pickerLayoutManager.setScaleDownBy(0.99f);
          pickerLayoutManager.setScaleDownDistance(0.8f);
  
          adapter = new PickerAdapter(this, getData(100), rv);
          SnapHelper snapHelper = new LinearSnapHelper();
          snapHelper.attachToRecyclerView(rv);
          rv.setLayoutManager(pickerLayoutManager);
          rv.setAdapter(adapter);
  
          pickerLayoutManager.setOnScrollStopListener(new PickerLayoutManager.onScrollStopListener() {
              @Override
              public void selectedView(View view) {
                  Toast.makeText(MainActivity.this, ("Selected value : "+((TextView) view).getText().toString()), Toast.LENGTH_SHORT).show();
              }
          });
      }
  
      public List<String> getData(int count) {
          List<String> data = new ArrayList<>();
          for (int i = 0; i < count; i++) {
              data.add(String.valueOf(i));
          }
          return data;
      }
  }
  