How to create a custom ListView in Sketchware?

The recently added Custom View in Sketchware can be used to create custom ListView. The steps you need to follow in order to create a custom ListView are given below.


1. In VIEW area of your sketchware project, add a ListView.

2. Add a new CustomView.

3. Now in properties of ListView, select the new view you added as customView.

4. Now in the VIEW area of CustomView, add a Linear (H) and a TextView.

5. In LOGIC area of your app, add a new list Map.

6. In onCreate event in your project, add items to the Map list using a single key. After adding items to list, setListCustomViewData of ListView to List Map (See image below).

7. In LOGIC area of your app add a new event​ ListView: onBindCustomView.

8. In event ListView: onBindCustomView, set the text of TextView in CustomView to the data from list Map.

9. If you want to implement some action on clicking any particular item in CustomView​, use the When view... clicked block available at the place where new variables are added.


10. Save and run the project to see the Custom ListView.

The video below shows how multiple lists can be used in a single Custom ListView.



Comments

  1. how to fix java.lang.NullPointerException. i am fetching data from firebase.. at very first use app is working but when i close app and open it again and open listview activity this error appear and says close application?

    please help.

    ReplyDelete
    Replies
    1. Sir i can not add source directly because i am using letest version of sketchware

      Delete
    2. Sketchware late version is comeback bring addsource directly

      Delete
  2. EditText wigit is not working in custom listview. Solution please...

    ReplyDelete
  3. Can i add this https://rentedfairly.blogspot.com
    to save and find my data , if yes then plz let me know how to do .
    skranjan27@gmail.com

    ReplyDelete
  4. How to fix that EditText isn't working in Custom ListView:
    Just add per 'add source directly'-Block this code:
    edittext1.setEnabled(true);
    edittext1.setClickable(true);
    edittext1.setFocusable(true);
    edittext1.setFocusableInTouchMode(true);

    ReplyDelete
  5. How add search function on custom listview?

    ReplyDelete
    Replies
    1. Search Custom ListView: https://youtu.be/CCgBEtrUFzE

      Delete
  6. And how add file preference on custom listview?

    ReplyDelete
    Replies
    1. Convert the ListMap to Json String and save that String in file shared preferences.

      Delete
  7. Escribo diferentes textos que se ingresan a una listview, pero al cerrar y abrir nuevamemte la app la lista esta vacĂ­a, pueden ayudarme?.. no se casi nada de programacion

    ReplyDelete
  8. How to add Custom List view In Drawer....

    ReplyDelete
  9. It doesn't have a "customv" option for me to choose, when I press the button "customView", it only came out with "none" selection. I can't create a customv

    ReplyDelete
  10. How to show new items first in a list view from firebase

    ReplyDelete

Post a Comment

Popular posts from this blog

A Flash Light App in Sketchware

Create Music Player app in Sketchware

In Sketchware: How to create a calculator for any simple formula?

Simple car racing android game in Sketchware

Firebase auth in Sketchware for Login Activity