I am trying to build an immersion via a custom XML layout.
My understanding is if I use CardBuilder, I would need to embed_inside but I wanted to use the entire screen with my XML layout.
It appeared that this was previously possible using card however that interface has been depreciated.
I may just be missing a basic Glass concept, but every example or document I have read so far accesses via CardBuilder.Layout and uses the predefined glass layouts.
You don't need to use the
CardBuilder
if you prefer to use your own custom layout: make sure to follow our design guidelines to make sure you meet our specs.To use your custom layout, simply inflate a
View
as you would normally and use in your application.For an
Activity
, you could something like:If you are using a
CardScrollView
, simply modify theCardScrollAdapter
'sgetView
method to return yourView
:I've had this issue myself, and I was able to solve it very easily. There isn't too much documentation about it, which is disappointing.
Since the Card class is deprecated and the CardBuilder.EMBED_INSIDE is fairly limited. The only option you have is to use a custom View, as was mentioned before. But you don't need to manually inflate it! If you use are using the CardScrollView and the CardScrollAdapter. You can do the following in your Activity:
Now I used a custom CardScrollAdapter because now it has views instead of CardBuilders:
Now simply create a layout that you want in an xml. And create your custom view: public class MyCustomView extends FrameLayout{
You can add as many custom views as you like. I hope it helps