Skip to content
This repository has been archived by the owner on Feb 8, 2022. It is now read-only.

Create a custom ViewController

Florent CHAMPIGNY edited this page Aug 3, 2015 · 1 revision

##Create a ViewController

You can add you own functions to Carpaccio, simply create a custom ViewControllers

for example MyViewController

public class MyViewController{

    public void myFunction(View view, String argument1){
        //your usage
    }

}

##Use your ViewController

Then you can use it into your layout

<com.github.florent37.carpaccio.Carpaccio
        app:register="
            com.mypackage.MyViewController
        ">

        <View
            android:tag="
               myFunction(theValueOfMyArgument)
            "/>

</com.github.florent37.carpaccio.Carpaccio>

##Options

Functions on ViewControllers must be public, and receive a View (or ImageView, TextView, etc.) as first parameters.

Others parameters can be String, int, Integer, float, Float, double, Double, long, Long

Clone this wiki locally