Google Glass Immersion Custom Layout without CardBuilder.Layout.EMBED_INSIDE

前端 未结 2 1292
春和景丽
春和景丽 2021-01-26 18:16

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 w

2条回答
  •  悲&欢浪女
    2021-01-26 18:37

    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:

    @Override
    protected void onCreate(Bundle bundle) {
        super.onCreate(bundle);
        setContentView(R.layout.my_custom_layout);
    }
    

    If you are using a CardScrollView, simply modify the CardScrollAdapter's getView method to return your View:

    @Override
    public View getView(int position, View convertView, ViewGroup parent) {
        // You can inflate the View using a LayoutInflater: 
        //     LayoutInflater.from(mContext).inflate(R.layout.my_custom_layout, parent);
        return mCustomView;
    }
    

提交回复
热议问题