Need help with FastLayout?
Click the “chat” button below for chat support from the developer who created it, or find similar developers for support.

About the developer

441 Stars 42 Forks Apache License 2.0 213 Commits 11 Opened issues


Generates a Java Object for your xml layout to reduce inflate time to zero

Services available


Need anything else?

Contributors list


Generates a Java Object for your xml layout to reduce inflate time to zero

This projects methodcount is very low, because everything happens on compile time.

Add the dependencies

main build.gradle

buildscript {
    repositories {
    dependencies {
        classpath 'io.fabianterhorst:fastlayout-gradle-plugin:0.0.2-alpha37'
app build.gradle
apply plugin: 'fastlayout'

First create your layout java class

This is needed to filter the layouts you want to compile

//this is compiling all layouts in layout folder
@Layouts(all = true, exclude = {R.layout.sample_item})
//there you can specify the layouts
//@Layouts(layouts = {"activity_main", "fragment_one"})
//@Layouts(ids = {R.layout.activity_main, R.layout.fragment_one})
//this is needed when you want to use the class fields
public class AppLayouts {

Now use the layout inside your Activity for example

public class MainActivity extends AppCompatActivity {

protected void onCreate(Bundle savedInstanceState) {
    //when you don´t wanna use the cache you can also just initiate the object
    //setContentView(new ActivityMainLayout(this));
    //The cache is reusing the object to improve the performance
    ActivityMainLayout layout = LayoutCache.getInstance().getLayout(context, LayoutCache.Activity_Main_Layout);



Specify a id for every view, otherwise the id is generated and can change.

We use cookies. If you continue to browse the site, you agree to the use of cookies. For more information on our use of cookies please see our Privacy Policy.