Попробуйте следующий код в onCreate
из Activity
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main); // A FrameLayout
final String LAYOUT = "{\n" +
" \"type\": \"TextView\",\n" +
" \"textSize\": \"28sp\",\n" +
" \"text\": \"Hello World!\"\n" +
"}";
final String DATA = "{}";
ViewGroup container = findViewById(R.id.container); // container is the FrameLayout
// create a new instance of proteus
Proteus proteus = new ProteusBuilder().build();
// register proteus with a ProteusTypeAdapterFactory to deserialize proteus jsons
ProteusTypeAdapterFactory adapter = new ProteusTypeAdapterFactory(this);
ProteusTypeAdapterFactory.PROTEUS_INSTANCE_HOLDER.setProteus(proteus);
// deserialize layout and data
Layout layout;
ObjectValue data;
try {
layout = adapter.LAYOUT_TYPE_ADAPTER.read(new JsonReader(new StringReader(LAYOUT)));
data = adapter.OBJECT_TYPE_ADAPTER.read(new JsonReader(new StringReader(DATA)));
} catch (IOException e) {
throw new RuntimeException(e);
}
// create a new ProteusLayoutInflater
ProteusContext context = proteus.createContextBuilder(this).build();
ProteusLayoutInflater inflater = context.getInflater();
// Inflate the layout
ProteusView view = inflater.inflate(layout, data, container, 0);
// Add the inflated layout into the container
container.addView(view.getAsView());
Проверьте simple-proteus-demo