Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to layer views

Tags:

android

I have a custom-made view that extends the View class. I would like 2 instances of my custom view layered directly on top of each other. How should my layout file look to achieve this?

like image 683
Finer Recliner Avatar asked Apr 13 '10 13:04

Finer Recliner


People also ask

What is a view layer?

Renders can be separated into layers, to composite them back together afterwards. Some example usages are applying compositing effects to characters separately, blurring the background and foreground layers separately for depth of field, or rendering different lighting variations of the same scene.

Can you edit a view layer?

Hosted feature layer views are ideal for helping you control access to the same hosted feature data; you can allow editing access to only those users who need it. You can make your hosted feature layer editable and share it with only those groups whose members need to edit the data.

How do I create a hosted layer?

Open Content > My Content, click New item, and click Your device. Find the file on your device. Select the file and click Open. Choose Add <file name> and create a hosted feature layer or table.


2 Answers

Turns out FrameLayout was what I wanted. Just do this in your layout:

    <FrameLayout  
        android:layout_width="fill_parent" 
        android:layout_height="wrap_content" >

        <com.proj.MyView
            android:id="@+id/board1"
            android:layout_width="fill_parent"
            android:layout_height="wrap_content"/>

        <com.proj.MyView
            android:id="@+id/board2"
            android:layout_width="fill_parent"
            android:layout_height="wrap_content" />

    </FrameLayout>
like image 144
Finer Recliner Avatar answered Oct 24 '22 09:10

Finer Recliner


Use a RelativeLayout. Later children of the RelativeLayout will overlap earlier children.

like image 43
CommonsWare Avatar answered Oct 24 '22 10:10

CommonsWare