Java Code Examples for android.support.v7.widget.LinearLayoutManager#setAutoMeasureEnabled()

The following examples show how to use android.support.v7.widget.LinearLayoutManager#setAutoMeasureEnabled() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: TwoFragment.java    From CollapsingRefresh with Apache License 2.0 5 votes vote down vote up
protected void setAdapter() {
	mAdapter = new MyAdapter(getContext());
	LinearLayoutManager layout = new LinearLayoutManager(getContext());
	layout.setSmoothScrollbarEnabled(true);
	layout.setAutoMeasureEnabled(true);
	recyclerView.setItemAnimator(new DefaultItemAnimator());
	recyclerView.setLayoutManager(layout);
	recyclerView.setAdapter(mAdapter);
	initData();
}
 
Example 2
Source File: OneFragment.java    From CollapsingRefresh with Apache License 2.0 5 votes vote down vote up
protected void setAdapter() {
	mAdapter = new MyAdapter(getContext());
	LinearLayoutManager layout = new LinearLayoutManager(getContext());
	layout.setSmoothScrollbarEnabled(true);
	layout.setAutoMeasureEnabled(true);
	recyclerView.setItemAnimator(new DefaultItemAnimator());
	recyclerView.setLayoutManager(layout);
	recyclerView.setAdapter(mAdapter);
	initData();
}
 
Example 3
Source File: RecyclerViewUtil.java    From diycode with Apache License 2.0 5 votes vote down vote up
public static <T extends SingleTypeAdapter> void init(Context context, RecyclerView recyclerView, T adapter) {
    LinearLayoutManager layoutManager = new LinearLayoutManager(context);
    layoutManager.setSmoothScrollbarEnabled(true);
    layoutManager.setAutoMeasureEnabled(true);
    recyclerView.setAdapter(adapter);
    recyclerView.setLayoutManager(layoutManager);
    recyclerView.setHasFixedSize(true);
    recyclerView.setNestedScrollingEnabled(false);
}
 
Example 4
Source File: OnlyLoadingActivity.java    From EasyRefreshLayout with Apache License 2.0 5 votes vote down vote up
private void initView() {
    easyRefreshLayout = (EasyRefreshLayout) findViewById(R.id.easylayout);
    recyclerView = (RecyclerView) findViewById(R.id.recyclerview);
    layoutManager = new LinearLayoutManager(this);
    layoutManager.setAutoMeasureEnabled(true);
    recyclerView.setLayoutManager(layoutManager);
    recyclerView.setHasFixedSize(true);
    adapter = new SimpleAdapter();
   // adapter.setDuration(1000);
   // adapter.openLoadAnimation(new MyAnimation());
    recyclerView.setAdapter(adapter);
    //scrollView = (ScrollView) findViewById(R.id.scrollview);
}
 
Example 5
Source File: AddTrackToPlaylistDialogFragment.java    From vk_music_android with GNU General Public License v3.0 5 votes vote down vote up
@Nullable
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    binding = DataBindingUtil.inflate(inflater, R.layout.layout_dialog_playlistselection, container, false);

    adapter = new VkAlbumAdapter(playlists, this);

    LinearLayoutManager layoutManager = new LinearLayoutManager(inflater.getContext(), LinearLayoutManager.VERTICAL, false);
    layoutManager.setAutoMeasureEnabled(true);

    binding.rcvPlaylists.setLayoutManager(layoutManager);
    binding.rcvPlaylists.setAdapter(adapter);

    return binding.getRoot();
}
 
Example 6
Source File: SettingsActivity.java    From BrainPhaser with GNU General Public License v3.0 4 votes vote down vote up
/**
 * This method is called when the activity is created
 *
 * @param savedInstanceState handed over to super constructor
 */
@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    setContentView(R.layout.activity_settings);

    Toolbar myChildToolbar =
        (Toolbar) findViewById(R.id.toolbar);
    setSupportActionBar(myChildToolbar);

    // Get a support ActionBar corresponding to this toolbar
    ActionBar ab = getSupportActionBar();

    // Enable the Up button
    ab.setDisplayHomeAsUpEnabled(true);

    //loading of the components
    RecyclerView settingsList = (RecyclerView) findViewById(R.id.settingsList);
    settingsList.addItemDecoration(new DividerItemDecoration(this, DividerItemDecoration.VERTICAL_LIST));

    // use a linear layout manager
    LinearLayoutManager layoutManager = new LinearLayoutManager(this);
    layoutManager.setAutoMeasureEnabled(true);
    settingsList.setLayoutManager(layoutManager);
    settingsList.setNestedScrollingEnabled(false);

    //Create the View
    //Adapter which sets all users into the list
    mSettingsAdapter = new SettingsAdapter(mUserManager.getCurrentUser().getSettings(), this, mSettingsLogic);
    settingsList.setAdapter(mSettingsAdapter);

    // Avoid scrolldown
    settingsList.setFocusable(false);
    (findViewById(R.id.heading)).requestFocus();

    final SettingsActivity self = this;
    Button resetButton = (Button) findViewById(R.id.resetButton);
    resetButton.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            self.resetSettings();
        }
    });
}