Image under another image

Put problem concerning Views, Layouts and other XML-Resources (like AndroidManifest) here.

Image under another image

Postby sudheer1437 » Mon Sep 07, 2009 4:40 pm

Hi guys,
On my way creating an app, I am stuck with a problem.
Where in I have a imageView(which is transparent), and der is another image(a bird image which is another imageview).
I want my bird image to be below the transparent imageView.
How to fix this problem.
Is there any concept of Z-order or depth or any other thing which ends up wid a solution.

Thanks in advance.
sudheer
sudheer1437
Experienced Developer
Experienced Developer
 
Posts: 79
Joined: Sat Aug 08, 2009 7:42 am
Location: India

Top

Postby wiederke » Tue Sep 08, 2009 12:04 pm

Hi,

use a FrameLayout. First add the bird view then the transparent image view.


cu,

Torsten
wiederke
Experienced Developer
Experienced Developer
 
Posts: 72
Joined: Mon Mar 02, 2009 6:46 pm
Location: Germany

Postby sudheer1437 » Wed Sep 09, 2009 11:53 am

Thanks wiederke for ur reply.

I am using framelayout only.... let me show u my xml code...

Syntax: [ Download ] [ Hide ]
Using xml Syntax Highlighting
  1. <?xml version="1.0" encoding="utf-8"?>
  2.  
  3. <AbsoluteLayout xmlns:android="http://schemas.android.com/apk/res/android"
  4.  
  5.    android:layout_width="fill_parent"
  6.  
  7.    android:layout_height="fill_parent"
  8.  
  9.    android:id="@+id/main_layout">
  10.  
  11.        
  12.  
  13. <ImageView android:id="@+id/ImageViewTop"
  14.  
  15.                            android:layout_height="wrap_content"
  16.  
  17.                            android:layout_width="wrap_content"
  18.  
  19.                    android:src="@drawable/top_curve"
  20.  
  21.                            android:layout_x="0px"
  22.  
  23.                            android:layout_y="0px"></ImageView>
  24.  
  25.                            
  26.  
  27.  
  28.  
  29.         <FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
  30.  
  31.    android:layout_width="fill_parent"
  32.  
  33.    android:layout_height="fill_parent">
  34.  
  35.         <com.android.bird.DrawView
  36.  
  37.      android:id="@+id/draw"
  38.  
  39.      android:layout_width="500px"
  40.  
  41.      android:layout_height="680px"
  42.  
  43.      android:layout_x="-90px"
  44.  
  45.      android:layout_y="-90px"/>
  46.  
  47. </FrameLayout>
  48.  
  49.      
  50.  
  51. </AbsoluteLayout>
  52.  
  53.  
Parsed in 0.003 seconds, using GeSHi 1.0.8.4





the drawview in framelayout is where my bird repainted.
i want my bird to be painted below the imageview(ImageViewTop).
sudheer1437
Experienced Developer
Experienced Developer
 
Posts: 79
Joined: Sat Aug 08, 2009 7:42 am
Location: India

Postby wiederke » Wed Sep 09, 2009 12:23 pm

Try this

Syntax: [ Download ] [ Hide ]
Using xml Syntax Highlighting
  1.  
  2. <?xml version="1.0" encoding="utf-8"?>
  3.  
  4. <FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
  5.  
  6.    android:layout_width="fill_parent"
  7.  
  8.    android:layout_height="fill_parent" >
  9.  
  10.      
  11.  
  12.     <com.android.bird.DrawView
  13.  
  14.        android:id="@+id/draw"
  15.  
  16.        android:layout_width="500px"
  17.  
  18.        android:layout_height="680px"
  19.  
  20.    />
  21.  
  22.    
  23.  
  24.     <ImageView android:id="@+id/ImageViewTop"
  25.  
  26.        android:layout_height="wrap_content"
  27.  
  28.        android:layout_width="wrap_content"
  29.  
  30.        android:src="@drawable/top_curve"
  31.  
  32.    />
  33.  
  34.    
  35.  
  36. </FrameLayout>
  37.  
  38.  
Parsed in 0.002 seconds, using GeSHi 1.0.8.4
wiederke
Experienced Developer
Experienced Developer
 
Posts: 72
Joined: Mon Mar 02, 2009 6:46 pm
Location: Germany

Postby sudheer1437 » Wed Sep 09, 2009 1:04 pm

I did it..
I got the solution..
i did wad u said...
thanks a lot....
sudheer1437
Experienced Developer
Experienced Developer
 
Posts: 79
Joined: Sat Aug 08, 2009 7:42 am
Location: India

Postby sudheer1437 » Thu Sep 10, 2009 7:35 am

Hi wiederke,
Thanks for ur support.

Now i am struck wid one more problem.
I have three different images of bird. I m painting the 3 different images on a canvas to get the effect that its flying.
the bird must bird in random path, starting from outside the screen and it shud end again outside the screen.
My logic is: i am generating the points randomly and painting the bird at those painta.
But its damn slow.....
Let my show my logic....

Syntax: [ Download ] [ Hide ]
Using java Syntax Highlighting
  1.  
  2. @Override
  3.  
  4.     protected void onDraw(Canvas canvas)
  5.  
  6.     {
  7.  
  8.         if(!blnDelay)
  9.  
  10.         {
  11.  
  12.                 if(isFirstTime)
  13.  
  14.                 {
  15.  
  16.                         updateTime();
  17.  
  18.                         counter = 0;
  19.  
  20.                         updateMode();
  21.  
  22.                         isFirstTime = false;
  23.  
  24.                 }
  25.  
  26.                                  
  27.  
  28. //              Random rand = new Random();
  29.  
  30.                 callChangeMode();
  31.  
  32.                 getimage();
  33.  
  34.                 drawCanvas = canvas;
  35.  
  36. //             bird_image.setViewHeight(getHeight());
  37.  
  38. //              bird_image.setViewWidth(getWidth());
  39.  
  40. //              double dx = Math.round(rand.nextInt(10));
  41.  
  42. //              double dy = Math.round(rand.nextInt(10));
  43.  
  44. //              dx = dx>0 ? dx:0;
  45.  
  46. //              dy = dy>0 ? dy:0;  
  47.  
  48.                    
  49.  
  50. //              bird_image.moveBird(randomValue,randomValue);
  51.  
  52. //              DrawView.this.birdX =  bird_image.getX();
  53.  
  54.                 DrawView.this.birdY =  bird_image.getY();
  55.  
  56.                
  57.  
  58.                 //draw the bird on the canvas
  59.  
  60.                 if(!BirdContext.isTimeCompleted)
  61.  
  62.                 {
  63.  
  64.                         canvas.drawBitmap(DrawView.this.birdimage, DrawView.this.birdX, DrawView.this.birdY, null);
  65.  
  66.                        
  67.  
  68.                 }
  69.  
  70.                 //invalidate();
  71.  
  72.                
  73.  
  74.         }
  75.  
  76.     }
Parsed in 0.036 seconds, using GeSHi 1.0.8.4



I want the bird to move as fast as it can...

is der any concept like...

we draw the path and tell the bird to move on that path...

Plz help me guys.........
sudheer1437
Experienced Developer
Experienced Developer
 
Posts: 79
Joined: Sat Aug 08, 2009 7:42 am
Location: India

Top

Return to View, Layout & Resource Problems

Who is online

Users browsing this forum: Yahoo [Bot] and 4 guests