This file contains 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
dependencies { | |
compile fileTree(dir: 'libs', include: ['*.jar']) | |
compile 'com.android.support:appcompat-v7:21.0.3' | |
compile "com.android.support:recyclerview-v7:21.0.0" | |
compile 'com.android.support:cardview-v7:21.0.3' | |
} |
This file contains 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
<style name="AppTheme" parent="Theme.AppCompat.Light.NoActionBar"> | |
<item name="colorPrimary">@color/color_primary</item> | |
<item name="colorPrimaryDark">@color/color_primary_dark</item> | |
</style> |
This file contains 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
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android" | |
android:layout_width="match_parent" | |
android:layout_height="match_parent"> | |
<android.support.v7.widget.RecyclerView | |
android:id="@+id/recyclerView" | |
android:layout_width="match_parent" | |
android:layout_height="match_parent"/> | |
<android.support.v7.widget.Toolbar |
This file contains 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 class MainActivity extends ActionBarActivity { | |
private Toolbar mToolbar; | |
private ImageButton mFabButton; | |
@Override | |
protected void onCreate(Bundle savedInstanceState) { | |
super.onCreate(savedInstanceState); | |
setContentView(R.layout.activity_main); | |
initToolbar(); | |
mFabButton = (ImageButton) findViewById(R.id.fabButton); |
This file contains 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
<?xml version="1.0" encoding="utf-8"?> | |
<android.support.v7.widget.CardView xmlns:android="http://schemas.android.com/apk/res/android" | |
xmlns:card_view="http://schemas.android.com/apk/res-auto" | |
android:layout_width="match_parent" | |
android:layout_height="wrap_content" | |
android:layout_gravity="center" | |
android:layout_margin="8dp" | |
card_view:cardCornerRadius="4dp"> | |
<TextView |
This file contains 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 class RecyclerItemViewHolder extends RecyclerView.ViewHolder { | |
private final TextView mItemTextView; | |
public RecyclerItemViewHolder(final View parent, TextView itemTextView) { | |
super(parent); | |
mItemTextView = itemTextView; | |
} | |
public static RecyclerItemViewHolder newInstance(View parent) { | |
TextView itemTextView = (TextView) parent.findViewById(R.id.itemTextView); |
This file contains 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 class RecyclerAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder> { | |
private List<String> mItemList; | |
public RecyclerAdapter(List<String> itemList) { | |
mItemList = itemList; | |
} | |
@Override | |
public RecyclerView.ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) { | |
final View view = LayoutInflater.from(parent.getContext()).inflate(R.layout.recycler_item, parent, false); |
This file contains 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
<android.support.v7.widget.RecyclerView | |
android:id="@+id/recyclerView" | |
android:layout_width="match_parent" | |
android:layout_height="match_parent" | |
android:paddingTop="?attr/actionBarSize" | |
android:clipToPadding="false"/> |
This file contains 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 class RecyclerAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder> { | |
//added view types | |
private static final int TYPE_HEADER = 2; | |
private static final int TYPE_ITEM = 1; | |
private List<String> mItemList; | |
public RecyclerAdapter(List<String> itemList) { | |
mItemList = itemList; | |
} |
This file contains 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
<View xmlns:android="http://schemas.android.com/apk/res/android" | |
android:layout_width="match_parent" | |
android:layout_height="?attr/actionBarSize"/> |
OlderNewer