Last active
April 1, 2017 06:47
-
-
Save Suleiman19/8f1215a6ebffa77dc51257e881b1aa10 to your computer and use it in GitHub Desktop.
Dummy Fragment that contains a scrollable list to demonstrate parallax scroll effect.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public static class DummyFragment extends Fragment { | |
int color; | |
public DummyFragment() { | |
} | |
@SuppressLint("ValidFragment") | |
public DummyFragment(int color) { | |
this.color = color; | |
} | |
@Override | |
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { | |
View view = inflater.inflate(R.layout.dummy_fragment, container, false); | |
final FrameLayout frameLayout = (FrameLayout) view.findViewById(R.id.dummyfrag_bg); | |
frameLayout.setBackgroundColor(color); | |
RecyclerView recyclerView = (RecyclerView) view.findViewById(R.id.dummyfrag_scrollableview); | |
LinearLayoutManager linearLayoutManager = new LinearLayoutManager(getActivity().getBaseContext()); | |
recyclerView.setLayoutManager(linearLayoutManager); | |
recyclerView.setHasFixedSize(true); | |
DessertAdapter adapter = new DessertAdapter(getContext()); | |
recyclerView.setAdapter(adapter); | |
return view; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment