Madona wambua
Madona wambua

Reputation: 1428

Adding several images on already existing background on Android Studio

I'm new in android programming and i want to add images in my already grid existing background.

This is my background image i want to add small images on left and right side of the background. Say animation images that i have designed but I don't know the procedure. Any help will be appreciated.

enter image description here

Upvotes: 2

Views: 1467

Answers (1)

Swami
Swami

Reputation: 163

If you want to put images on in front the background image, it is best if you use a FrameLayout or RelativeLayout. If you do not want it on top but on the side, you should use LinearLayout in "horizontal" orientation.

<FrameLayout android:id="@+id/my_ph"    
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="wrap_content"
android:layout_height="wrap_content">
<ImageView  
    android:id="@+id/background_image"
    android:layout_width="wrap_content" 
    android:layout_height="wrap_content" 
    android:src="@drawable/sketch" android:layout_alignParentTop="true"/>

<ImageView  
    android:id="@+id/image2"
    android:layout_width="fill_parent" 
    android:layout_height="fill_paren" 
    android:layout_alignTop="@id/image"
    android:layout_alignLeft="@id/image"
    android:layout_alignRight="@id/image"
    android:layout_alignBottomp="@id/image"
</FrameLayout>

or

<LinearLayout
android:id="@+id/my_ph"    
xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="horizontal"
android:layout_width="wrap_content"
android:layout_height="wrap_content">

<ImageView  
    android:id="@+id/image1"
    android:layout_width="fill_parent" 
    android:layout_height="fill_paren" </>

<ImageView  
    android:id="@+id/background_image"
    android:layout_width="wrap_content" 
    android:layout_height="wrap_content" 
    android:src="@drawable/sketch" android:layout_alignParentTop="true"/>

<ImageView  
    android:id="@+id/image2"
    android:layout_width="fill_parent" 
    android:layout_height="fill_paren" </>
</LinearLayout>

Upvotes: 1

Related Questions