Create a gist now

Instantly share code, notes, and snippets.

What would you like to do?
Android Material Tabs
package com.webheavens.manishkprmaterialtabs.fragments;
import android.content.Context;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import com.webheavens.manishkprmaterialtabs.R;
import com.webheavens.manishkprmaterialtabs.adapters.CommonRecycleAdapter;
import java.util.ArrayList;
import java.util.List;
import butterknife.Bind;
import butterknife.ButterKnife;
public class PostsFragment extends Fragment {
@Bind( RecyclerView recyclerView;
public static Fragment newInstance(Context context) {
PostsFragment f = new PostsFragment();
return f;
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
ViewGroup root = (ViewGroup) inflater.inflate(R.layout.content_main, null);
return root;
void setUpView(ViewGroup root){
ButterKnife.bind(this, root);
void setUPList(){
recyclerView.setLayoutManager(new LinearLayoutManager(getActivity()));
CommonRecycleAdapter adapter = new CommonRecycleAdapter(createItemList());
private List<String> createItemList() {
List<String> itemList = new ArrayList<>();
for(int i=0;i<30;i++) {
itemList.add("Item "+i);
return itemList;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment