Posts

Showing posts with the label ListView

android - Change ListView text color, font, size and style

activity_main.xml xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto" android:id="@+id/coordinator_layout" android:layout_width="match_parent" android:layout_height="match_parent" android:background="#f1f4fa" > <

android - CardView inside a ListView

activity_main.xml xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto" android:id="@+id/coordinator_layout" android:layout_width="match_parent" android:layout_height="match_parent" android:background="#fdfdfd" > <

android - Custom ListView with image and text

activity_main.xml xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto" android:id="@+id/coordinator_layout" android:layout_width="match_parent" android:layout_height="match_parent" android:background="#859488" > <

android - ListView divider color and height

activity_main.xml xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto" android:id="@+id/coordinator_layout" android:layout_width="match_parent" android:layout_height="match_parent" android:background="#a8bfa4" > <!

android - ListView item align right

activity_main.xml xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto" android:id="@+id/coordinator_layout" android:layout_width="match_parent" android:layout_height="match_parent" android:background="#cbd2c7" > <

android - How to create ListView states

activity_main.xml xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto" android:id="@+id/coordinator_layout" android:layout_width="match_parent" android:layout_height="match_parent" android:background="#627062" > <

Sectioned RecyclerView in android

Image
Sectioned RecyclerView in android Created a sample Sectioned RecyclerView Application. I used the following Library to easily create this one. https://github.com/afollestad/sectioned-recyclerview Credits : Aidan Follestad Step: 1 ====== Add a dependency to the build.gradle file [ or] You can download the SectionedRecyclerViewAdapter .java file and put in it your source code. compile ( ' com . github . afollestad : sectioned - recyclerview: 0.1 . 0 ' ) { transitive = true } Step: 2 ====== Created a Sample Activity with RecyclerView in the Xml Layout file. Populated with dummy data for sample. package com . pratap . sectionrecyclerview ; import android.os.Bundle ; import android.support.v7.app.AppCompatActivity ; import android.support.v7.widget.GridLayoutManager ; import android.support.v7.widget.RecyclerView ; import android.support.v7.widget.Toolbar ; import com.pratap.sectionrecyclerview.models.DataModel ; import com.pratap.sectionrecyclerview.utils

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

Recyclerview with Cards example in Android with AppCompat (V7)

Image
I have created a sample application to show RecyclerView and CardView in android with Latest Appcompat Library (V7 Library). Step 1: Import three Libary Project to the Eclipse 1) AppCompat 2) RecyclerView 3) CardView from the folder android-sdk\extras\android\support\v7 Step 2 : Create a new Project/download the Source from below,  and add the three Libary Projects to the MainProject as a Library Projects. 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 ; import android.view.Menu ; import android.view.MenuItem ; import android.widget.Toast ; public class CardViewActivity extends ActionBarActivity { private Toolbar toolbar ; private RecyclerView mRecyclerView ; private RecyclerView . Adapter mAdapter ; private RecyclerView . LayoutManag