Android : Place Controls At Absolute Positions - Custom ViewGroup
Sep 26, 2010
I have a custom ViewGroup. The idea is to be able to place controls at absolute positions and then have the ViewGroup scale those controls based on the difference in the screen dimensions with respect to the original design dimensions. I am using the code below. In response to the 'onMeasure' message, I am storing the width and height of the view. Then on the 'onLayout' message I am computing new dimensions for the child controls and adjusting their sizes proportionally. This all works to some degree. However for certain controls (e.g. button controls), the control resizes, but the text inside does not remain centered within the control. I am thinking that there is some other call I need to make to update the child controls after I change their size.
View 3 Replies
Nov 18, 2010
I need to place additional image button "my current location" to a top right corner of the MapView. Any ideas how to do this?
Making the questions generic:
1) According to MapView documentation it is possible to attach additional view objects to a MapView. How to do this?
2) How to place such additional controls into specific position on MapView?
View 1 Replies
View Related
May 19, 2010
I am new to Android, and I am trying to understand how to create a custom ViewGroup. I created MyViewGroup as follows: Code...
View 2 Replies
View Related
May 24, 2010
I am trying to create a ListView and add it to a custom ViewGroup.
Here is my code:
CODE:.................
View 3 Replies
View Related
Aug 2, 2010
I've got the following node in my XML layout:
CODE:.................
TagLayout is a class that extends ViewGroup, and basically holds a bunch of buttons with text (a custom object that act as tags, but that's neither here or there).
The problem is that when there are too many buttons, the view no longer scrolls. I can confirm that I am adding tags but I can't see anything.
If I wrap the above within a ScrollView, the layout never renders. I tried adding the attributes android:isScrollContainer and android:scrollbars, but that doesn't change anything. Is there something I'm missing here?
I should also add that TagLayout is overriding the onMeasure() event. I guess I need to implement a scrolling mechanism there...?
View 1 Replies
View Related
Nov 17, 2010
I have a custom ViewGroup that I wrote, and have been able to use it to lay out child elements in code just fine. However, now I'd like to be able to use it for layout in XML. I would also like to be able to add some custom attributes to the XML file to better control my layout. How do I set up, both in XML and in code, a set of custom attributes? Bonus if it can be used with the built in designer in Eclipse.
View 1 Replies
View Related
Jun 17, 2009
I want to have a ViewGroup with another View in it. The user should be able to move the other View around the ViewGroup, and fling it away. However, the inner View shouldnt only move, it should also scale and so on (so we dont restrain ourselves to just movements). I don't really know the best way to implement it.
First I though about using a ViewGroup pretty much as it is (i.e. take advantage of the already-written methods). Then I could do the flinging with an Animation. However, when I move the View around with my finger, wouldnt I have to do a requestLayout, since the View changes size when I move it? Or could I just set a transform?
The other alternative would be to override the draw-method and do most of the work myself. For instance, when the user moves his/her finger, I could get a cache of the View and just paint it on the Canvas (with some transform). However, how would I do the flinging then, without an Animation? I could use a Scroller/VelocityTracker, but What would "drive" the repaints? Which is the best way to do this? Also, I won't have just one View, but a couple of them, so I'd like the solution to be effective.
View 2 Replies
View Related
Oct 19, 2010
I've extended ViewGroup to achieve something like a FlowLayout.I put my custom ViewGroup into a ScrollView, dynamically add a bunch of content and it doesn't scroll.The content that flows off the screen is not viewable.What am I missing, how can I allow my ViewGroup to be compatible with ScrollView?
View 1 Replies
View Related
Jun 25, 2009
I would like to create a custom Control in my Android App. It will be a circular control with some smaller moveable circles that will indicate a specific value.
Is there a way to realize this?
Are there at least some nice Tutorials where i can read how to create a custom control?
View 1 Replies
View Related
Sep 10, 2010
I have a custom list adapter contains a layout with controls in it. I was wondering how I can get each individual controls id? I am planning on changing the color of some textviews. code...
View 1 Replies
View Related
May 27, 2010
I'm suffering from this for a week, i was trying to use the famous SeekBarPreference in a dialog - http://android.hlidskialf.com/blog/code/android-seekbar-preference
I copied the class from above link into my project. Then created the xml as brightness.xml:
CODE:............
Finally I try to integrate it as custom dialog:
CODE:......................
View 3 Replies
View Related
Nov 8, 2012
I am trying to make/edit my first custom rom. As base i am using the Oxygen rom. This rom has all his apps stored in system/app. I inserted an launcher(hololauncher), keyboard(custom htcime) and gallery(quickpick) apk in this folder, but after the rom is flashed these apps are causing fc's and the gallery app isnt even flashed.
I know that not every apk can be placed in the system/app folder, but how can i ensure that these apps will install correctly during flashing.
View 5 Replies
View Related
Oct 13, 2010
Hope you all are doing good. i am having query to place button in my main view. This is the code but it creates button on upper part in center but i want to shift it bit down wards. Any body knows how can i place button in main view where i want?
View 3 Replies
View Related
Apr 6, 2012
how can I place the cube in a specific place on the screen?
View 8 Replies
View Related
Aug 20, 2010
I'll notify something to user after 30 minutes for example. so I need to get a time which is not changable by user or anything. Does it call UTC? I guess I need to get current time and it should have nothing to do with user handle or location actually, I'm focusing '30minutes from now' rather than current time. It also should work even in case of power off and on. Can I use alarm manager for this?
View 12 Replies
View Related
Oct 19, 2010
My question today relates to the android home screen and where it stores icon / widget positions. Specifically, I am interested in accessing the positions and sizes of any icons that are currently being displayed. I have, so far, been unable to find a method of retrieving the positions of other applications but i figure it must be possible in some way due to the presence of third-party home screen applications. Ideally, I am hoping to query the positions of whatever is on the screen at the moment from a live wallpaper and adjust my rendering accordingly.
View 1 Replies
View Related
Sep 30, 2009
I need to implement a screen containing a list of blocks one below the other. Each block will contain mutiple superimpose elements (Images, text) for which the relative position needs to be specified with respect to the top left corner of the block.
For creating the list of blocks i have used listview. For each block i tried to use relative layout.This works ok when the phone is in landscape mode and absolute position is specified relative to left edge of the phone. But when the phone is put in the portrait mode the layout gets distorted.
1) What layout can be used for this scenario?
2) Can relative positions be specified in terms of percentage of screen width/height instead of pixels?
View 3 Replies
View Related
Aug 27, 2009
How can I retrieve the positions of the selected item in a multichoice listView ? The getSelectedItemPosition method returns only the first one...
View 1 Replies
View Related
Feb 8, 2010
I'm trying to get the absolute screen pixel coordinates of the top left corner of a view. However, all methods I can find such as getLeft() and getRight() don't work as they all seem to be relative to the parent of the view, thus giving me 0. What is the proper way to do this?
If it helps, this is for a 'put the picture back in order' game. I want the user to be able to draw a box to select multiple pieces. My assumption is that the easiest way to do that is to getRawX() and getRawY() from the MotionEvent and then compare those values against the top left corner of the layout holding the pieces. Knowing the size of the pieces, I can then determine how many pieces have been selected. I realise I can use getX() and getY() on the MotionEvent, but as that returns a relative position that makes determining which pieces were selected more difficult. (Not impossible, I know, but it seems unnecessarily complicated).
View 4 Replies
View Related
Nov 4, 2009
View.getLeft() and View.getTop() give the position of the view relative to the parent.
Is there a way to get the absolute screen position of that view?
Either a way to translate those coordinates into screen coordinates to make a call to get the position in screen coordinates.
View 2 Replies
View Related
Oct 29, 2010
I am trying to go widget-free, using Zeam launcher instead of LauncherPro which seems to randomly have issues for me, I'm just wondering what tips you all may have for getting the best performance possible from your phone. I'm on a Captivate. I care more about in-app performance and stability over bells and whistles. What do you suggest?
View 6 Replies
View Related
Sep 11, 2009
I am implementing OnTouchListener and am receiving MotionEvent objects. Some ACTION_MOVE events reports absolute X/Y coordinates, while some reports relative coordinates.
How can I ask a MotionEvent what kind of coordinates it currently represents?
View 3 Replies
View Related
Mar 30, 2010
Seeking help to design a layout as shown here:
http://docs.google.com/Doc?docid=0AQhgDtGvE2HgZGZ6cmtua185MTd0eGdyZmc&hl=en
The major challenge I face is aligning the components at desired positions. Please refer the three buttons(icons) and the way they are positioned.
Literally, going nuts, thinking how to position those exactly at the desired places.
View 2 Replies
View Related
Jul 21, 2010
Suppose I have the following layout
CODE:......................
How could I swap position of button01 with button02? And would it work also for swapping button01 with button05?
Before asking what I have tried so far, I don't even know where to start. I googled but the only answer I could find was about AbsoluteLayout.
View 1 Replies
View Related
Nov 18, 2010
Hi, i have a googlemap app that displays two items (itemizedoverlay class) and i have a Update button. When i press the update button, i want to remove the items from the map, and put again the same items but with the new latitude and longitude values (i have a service that actualice the latitude and longitude fields that i have in sharedPreferences, and also i recibe the other position by a bundle)
what i am doing wrong? when i try my code, the items of the map doesn't be removed.... just new items appear... but i want to remove the old ones
CODE:...........
And these are my two functions:
CODE:............
I also tryed with invalidate() on the mapview but it doesn't works... still paint the old items...
View 1 Replies
View Related
Jun 7, 2010
I'm currently working on a very simple aplication, and I intended to make it change the visual aspect depending on the screen size. The application just has 6 buttons like this:
I'm using the AbsoluteLayout, and changing the x and y of the buttons with the methods offsetLeftAndRight and offsetTopAndBottom. I'm not changing the layout of the buttons in the xml file, so the all start in the same place.
However, if I use this methods inside the onClickMethod they sometimes appear where I want them, sometimes don't (can't figure out why), but if i use them in the onCreate method, nothing happens.
View 2 Replies
View Related
Oct 16, 2010
I am trying to create a gradient drawable to depict a ratio of something. As a general example, lets say you were looking at a listview containing a fleet of cars. The background could be a fuel gauge - I don't want a smooth, wide transition. I want a very tight transition, and I want to be able to set where that transition takes place.
Here's what I'm staring with, but I'm not getting very far.
CODE:......................
View 1 Replies
View Related
Sep 2, 2009
I need to get the absolute path of the file associated with a specific android.net.Uri instance. I know how to get the URI instance based on the file instance (with Uri.fromFile(file)) and i need the inverse action.
View 4 Replies
View Related
Nov 9, 2010
What is the absolute path of the assets folder? I need it to reference some images saved in this folder from a html file saved in the memory device.
View 1 Replies
View Related
Nov 11, 2010
How do I reference the assets from phone memory? I need it to write the absolute path into a html file to load some images which are in assets folderThis html is saved in the phone memory but I can't to save these images in the memory phone because these are very big.
View 1 Replies
View Related