简体   繁体   中英

how to display multiple image on one screen in android like layer of photoshop

I am new to android development so I don't have much experience.

I want to develop an app for children in which I want display images (png or bitmap) of a sky, mountain, river in a combined manner and children can change the color of the sky ( that means only the sky bitmap will change ).

I want to display all bitmaps one over another like a Photoshop layer so children can add a tree or a small mountain to the view by clicking a button.

Please guide me on how I can work on such image manipulation. Which techniques do I have to use for this?

Just a starting point:

  • All your bitmaps must have a transparent background.
  • Use a RelativeLayout and add your Bitmap on it (RelativeLayout allows you to place childs overlapping each other)
  • You can use margin to position bitmaps where you want in your RelativeLayout

EDIT

Here is a simple layout with 2 bitmaps (image1 and image2 both have a transparent background) overlapping each other.

<?xml version="1.0" encoding="utf-8"?>

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
            android:orientation="vertical"
            android:id="@+id/relativeLayout"
            android:layout_width="fill_parent"
            android:layout_height="fill_parent"

    >
     <ImageView
            android:background="@drawable/image1"
            android:layout_width="match_parent"
            android:layout_height="match_parent"/>

     <ImageView
            android:background="@drawable/image2"
            android:layout_width="match_parent"
            android:layout_height="match_parent"/>
</RelativeLayout>

It depends on your requirements. If you really want to create complex application I would recommend you to use a game engine. Like cocos-2dx, for example. It's free, cross-platform and there are a lot of graphics processing features out of box. There are layers, filters, animation... and it works very fast.

If you are android SDK fan then create a custom view and use it's canvas. It wont be easy. But if your app is simple enough you better stick with canvas.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM