Posts

Showing posts with the label toolbar

RecyclerView with onClick and onLongClick implemtation in android example

Image
In the Previous Post , We have create list of items with RecyclerView using appcompat v7. Now, we have implemented onclick event functionality in the previous post for each list item using stackoverflow link. Now, I have update the code to latest Android Api RecyclerView default way of implementing onClick and onLongClick on the each item. Step 1 : Create an Activity with recyclerview CardViewActivity.java package com . pratap . cardviews1 ; import android.os.Bundle ; import android.support.v7.app.ActionBarActivity ; import android.support.v7.widget.LinearLayoutManager ; import android.support.v7.widget.RecyclerView ; import android.support.v7.widget.Toolbar ; public class CardViewActivity extends AppCompatActivity { private Toolbar toolbar ; private RecyclerView mRecyclerView ; private RecyclerView . Adapter mAdapter ; private RecyclerView . LayoutManager mLayoutManager ; @Override protected void onCreate ( Bundle savedInstanceState ) { super . onCreate ( sa

Using Toolbar in android in LollyPop and Pre-Lollypop Devices - Part 2

Image
1) toolbar.xml <? xml version = "1.0" encoding = "utf-8" ?> < android . support . v7 . widget . Toolbar xmlns: android = "http://schemas.android.com/apk/res/android" xmlns: app = "http://schemas.android.com/apk/res-auto" xmlns: tools = "http://schemas.android.com/tools" android: id = "@+id/toolbar" android: layout_width = "match_parent" android: layout_height = "wrap_content" android: background = "@color/md_blue_500_primary" android: minHeight = "?attr/actionBarSize" app: popupTheme = "@style/ThemeOverlay.AppCompat.Light" > </ android . support . v7 . widget . Toolbar > 2) activity_main.xml <LinearLayout xmlns:android= "http://schemas.android.com/apk/res/android" xmlns:tools= "http://schemas.android.com/tools" android:layout_width= "match_parent" android:layout_height= "matc