Did anybody tried this[Map problem]

Put your problem here if it does not fit any of the other categories.

Did anybody tried this[Map problem]

Postby rahul_mawkins » Mon Mar 10, 2008 5:23 pm

I am trying to put some TextView over the map
Something like current latititude/longitude etc

Can we use draw function???
If so how???

Thanks in advance for any help
rahul_mawkins
Developer
Developer
 
Posts: 34
Joined: Wed Feb 27, 2008 4:09 am

Top

Postby plusminus » Mon Mar 10, 2008 7:32 pm

Hello rahul,

For placing Views over another View have a look here: viewtopic.php?p=4590#4590

For drawing things on the top of a MapView have a look on the FriendFinder-Tutorial and here.

Regards,
plusminus
Image
Image | Android Development Community / Tutorials
User avatar
plusminus
Site Admin
Site Admin
 
Posts: 2688
Joined: Wed Nov 14, 2007 8:37 pm
Location: Schriesheim, Germany

thanks you sir

Postby rahul_mawkins » Mon Mar 10, 2008 9:27 pm

Hey +/- thanks for this one
So you mean that we do can add normal text/edittext views etc over the canvas too
I really like the first one and have seen this earlier but guess you are sending this to
challenge itself as an entry :)
Just was curious how we can add normal text/edit text view over the current canvas
Share the snippits if not the actual code
rahul_mawkins
Developer
Developer
 
Posts: 34
Joined: Wed Feb 27, 2008 4:09 am

Or atleast you can tell

Postby rahul_mawkins » Mon Mar 10, 2008 9:45 pm

How you made the rectangle at the bottom transparent
rahul_mawkins
Developer
Developer
 
Posts: 34
Joined: Wed Feb 27, 2008 4:09 am

Postby plusminus » Mon Mar 10, 2008 10:28 pm

Hello Rahul,

You can place any View over any other View.
The code is just the same as the one after my previous link, except you need to change the class from ImageView to TextView/EditText.

Simply call [font=Lucida Console]myPaint.setAlpha(int alphaValue);[/font] on the Paint you are drawing the rectangle to the canvas.

Regards,
plusminus
Image
Image | Android Development Community / Tutorials
User avatar
plusminus
Site Admin
Site Admin
 
Posts: 2688
Joined: Wed Nov 14, 2007 8:37 pm
Location: Schriesheim, Germany

You rock man

Postby rahul_mawkins » Mon Mar 10, 2008 10:44 pm

Simply amazing
Yes setting alpha works
Let me try the textView stuff
Thanks again man
rahul_mawkins
Developer
Developer
 
Posts: 34
Joined: Wed Feb 27, 2008 4:09 am

Top

sorry to bother you

Postby rahul_mawkins » Mon Mar 10, 2008 11:11 pm

But again I dont see anywhere where I can draw a textview/editview on canvas
I mean on canvas you can draw text but again you just cant editView on canvas

Also can you share your code a bit where you created a ImageView from a image
and draw on canvas
I see that you have decoded the image as bitmap and then on canvas you are drawing
the bitmap

Sorry if I didnt catch what you mean
Please help
rahul_mawkins
Developer
Developer
 
Posts: 34
Joined: Wed Feb 27, 2008 4:09 am

Postby plusminus » Tue Mar 11, 2008 12:30 am

Hello rahul,

you do not draw a EditText over a Map, but you define it in xml to be above, just like this:

This code ...
Syntax: [ Download ] [ Hide ]
Using xml Syntax Highlighting
  1. <?xml version="1.0" encoding="utf-8"?>
  2. <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
  3.     android:layout_width="fill_parent"
  4.     android:layout_height="fill_parent">
  5.      <view class="com.google.android.maps.MapView"
  6.          android:id="@+id/map_map"
  7.          android:layout_width="fill_parent"
  8.          android:layout_height="fill_parent"/>
  9.      <ImageView
  10.          android:id="@+id/iv_map_zoomin"
  11.          android:layout_alignParentTop="true"
  12.          android:layout_alignParentRight="true"
  13.          android:layout_width="wrap_content"
  14.          android:layout_height="wrap_content"
  15.          android:src="@drawable/plus_32"/>
  16.      <ImageView
  17.          android:id="@+id/iv_map_zoomout"
  18.          android:layout_alignParentTop="true"
  19.          android:layout_alignParentLeft="true"
  20.          android:layout_width="wrap_content"
  21.          android:layout_height="wrap_content"
  22.          android:src="@drawable/minus_32"/>
  23. </RelativeLayout>
Parsed in 0.003 seconds, using GeSHi 1.0.8.4


... produces this output (two clickable (Image)Views, being automatically drawn above of the map(and potentional map-overlays)):
See the upper corners of the mapView.
Image


Regards,
plusminus
Image
Image | Android Development Community / Tutorials
User avatar
plusminus
Site Admin
Site Admin
 
Posts: 2688
Joined: Wed Nov 14, 2007 8:37 pm
Location: Schriesheim, Germany

Hey thats amazing

Postby rahul_mawkins » Tue Mar 11, 2008 1:11 am

I tried the same but didnt get anything
Then I switched my layout to relativelayout
and everything was right there
Wonder why things in Linear Layout didnt work

But guess that gives me a head on

I really appreciate your kind help

Thanks
Rahul
rahul_mawkins
Developer
Developer
 
Posts: 34
Joined: Wed Feb 27, 2008 4:09 am

Top

Return to Other Coding-Problems

Who is online

Users browsing this forum: No registered users and 18 guests