Android :: Overlapping Imageviews Without Using AbsoluteLayout
May 4, 2009
since I have updated my project (http://code.google.com/p/ bestcardgameever-android/) to the 1.5SDK, I need to switch the deprecated AbsoluteLayout with something else. The problem is the project is a card game that has cards showing and some of them need to be overlapping (take a look at this note the cards in the center) I could really use a tip on how to do this with a FrameLayoutetc.
I'm trying to figure out how to animate in and out of Imageviews.
Basically I have a LinearLayout with an ImageView and a Button at the bottom. Everytime the button is pressed, onClick() is invoked and I do
I simply change the image displayed on the ImageView by selecting different photos in the @drawable. Now I want to put an animation when these imageviews are changed (when button pressed). I used
inAnimation = AnimationUtils.makeInAnimation(this,true);and in onClick() I do image.setImageResource(imageArray[imageCounter]); image.startAnimation(inAnimation);
This works fine too. The new image comes to the screen animated. But how can put an out animation too? It seems only one animation can be assigned with startAnimation().
What is the best way to animate an imageview OUT and then animate another imageview IN? Because I want to change the animation depending on the button pressed, I cannot use ViewFlipper. For example, if I press button_Anim1, current image will slideout from right and the new image will fade in. But if I press button_Anim2, current image will slideout from top and the new image will slidein from left. And so on.
I see that I cannot use two different image.startAnimation() in the onClick() method to make the current image View.INVISIBLE and then make the new image View.VISIBLE.
I need help coming up with a way of executing the following sequence using some type of view or layout combination in Android:I have 3 image objects... say object A, B, and C...I have tried every combination of Threads, AsyncTasks, Handlers, custom layouts, AnimationListeners, etc. but everything I've tried has failed. If only the ViewSwitcher could take more than 2 views.
I want to load bitmaps into ImageViews in Android, but I don't want to use the R.drawable syntax because I have a lot of images with a standard naming convention so it's much easier to get the image with some logic. For example, all my images are named:
img1.png img2.png img3.png
So if a user selects a value, let's say x, I show "img" + x + ".png" in the ImageView. Looks like Bitmap.decodeFile is what I need, but I need to know the syntax of how to get to my drawables folder since that's where the images are. Or if there's perhaps a better way.
I realize I could do this with a switch statement instead of concatenating the image name but that would be a lot of lines since I have so many images.
I have a table-top style game board consisting of 10x10 squares. Each square is a PNG image. On top of these squares I want to place tiles which can be drag and dropped on top of the squares.
What would be my best approach concerning Views?
Is it possible to have two layers where layer one is a grid of ImageView's which represents the board. Would it then be possible to let the tile be an ImageView also which could be "stacked" on top of the ImageView's which represents the board?
In my application I have a title(TextView) and an Image. The image is grabbed from the web and most of the images are different sizes. Some of these images are to tall and overlap on top of my textview, covering it up. Is there anyway to prevent this? code...
I'm trying to develop a coloring app... while developing it ....i was stuck with a problem..Im using layout to display "images". The problem is that the images get overlapped...
for example i have arranged the images as ...the second image inside the first image.... if i color the second image, the first image also gets colored...similarly if i color the first image , the second one also gets colored....the images are overlapped....
how to color each image separately ? and how to prevent overlapping of two images?
I understand the problems with assigning a fixed position to UI components, but I would like to use AbsoluteLayout in a way such that the position of the components are chosen dynamically, calculated based on the screen size.Here is why I am thinking this may be easiest:I want to display a nXm grid of imageViews on the screen (n,m chosen by the user) with 0 padding betweeen the image Views.With absoluteLayout, I could easily choose the size of the imageViews and in a way that maximizes the amount of the screen that is used.The reason that using relativeLayout or LineraLayouts may not work for this is because when a user touches an image in this grid, I would like it to "pulse" (quickly scale larger than back to its normal size).If I scale an imageView using realtive or linear layout,it would resize the adjacent imageViews (since the padding is 0), which I don't want.
I would prefer permitting temporary overlapping of the imageViews.This is currently the approach I have taken, except instead of changing the position of imageViews, I am just drawing bitmaps to the canvas at the locations I calculated.I can't use the animation framework, however, on bitmaps that I draw to a canvas.Is this an acceptable use for AbsoluteLayout, or is there a better way to achieve what I want to do here?
I need to load several ImageViews into a layout. The ImageViews are used to show a rating using 'star' icons. The number of stars (i.e. the rating is determined during loading by reading a configuration file.
The ImageViews are sitting inside a RelativeLayout layout.
Currently I am using something like this:
My quesions are:
1) Is doing the loading dynamically (not using an xml) is the 'right' way of doing this ?
2) If it is, how do I make the stars display in a line, currently they get placed one on top of the other.
I have just realised that AbsoluteLayout has been deprecated in the latest sdk, however I have designed my apps based on AbsoluteLayout and it is very difficult for me to remove them and change it to a different layout. Can someone help me as to how I should proceed? Absolute layout was really helpful in positioning the elements to be accurate. One could always had different layout definitions for different screen sizes, and based on the current width and height the required layout can be set. Removing of AbsoluteLayout is creating a lot of frustration to me as I have already designed most of the things using it. Somebody please help me out.
Are there currently any plans to replace AbsoluteLayout in in WebView? I need to place native controls based on the coordinates of elements in the WebView. I'm currently using a separate View to manage the layer, but I'd prefer to override the layout in WebView.
I see posts saying that FrameLayout is the alternative, and that I should use margins to position things (this strikes me as wildly counter intuitive, but ok... if it works, I'll take it). However, I can't get it to work, so, I'm looking for assistance. I'm aware of the fact that this may mean different things on different devices. I'm ok with that. I simply need a way to, programatically, and at run time, place an item at a SPECIFIC location. I don't want to rely on gravity (or the laws of thermodynamics). I just want to specify a location and have the element appear there :)
I have a requirement where few of my image views form border areas of an application, the application will be running on many screen sizes. I'll be creating a uniform image for the smallest size possible, which can be repeated as many times as needed, and still presents the same image. i want the image view to replicate the image contained whenever it is increased.
Perhaps I was able to describe my problem. Is anything like this possible?
I tried 9-patch images, but I couldn't find nice articles on it which could explain how to create useful images with it which could suite my need.
AbsoluteLayout has become obsolete, I need to convert it to FrameLayout.My problem is in AbsoluteLayout. LayoutParams, I can specify (x,y) in the constructor, which specify the location of my view during layout.How can I achieve using FrameLayout + FrameLayout.LayoutParams?
I'm making a android aplication, and I need creates buttons in the java files because the amount of buttons is variable and the coordinate of each button too. So, I don't know how set the coordinates x,y in java. Do you know what method i can use to set this values?
I'm just starting to get the hang of animations, tweened animations that is. I have made several imageviews with pictures rotating and moving, and its all very fun, but I don't know what the best approach for doing multiple animations is.
For example I created a LinearLayout and stuck some ImageViews in it and wrote this:
for each imageview. So they all spin. But now I want to step it up a gear. But reaidng other sources on the net it seems some people use canvas to do animations. What is the best way?
I noticed that AbsoluteLayout is deprecated in the latest SDK. AbsoluteLayout is an important piece to implementing drag and drop. If it disappears in a later release, what will be the solution to implement drag and drop?
Seems I had taken a screenshot of my lock screen and *that* is what I set as my lock screen wallpaper. Once I tried a default wallpaper all was fine. When I went back to input what I wanted from my gallery, I realized I'd chosen a photo from the screenshot folder. Very red faced here.
Never seen this before, but suddenly after a factory reset I have two clocks overlapping one another on the lock screen. It's not like a ghosting effect, but you can tell they're overlapping because their alignment is slightly different from one another. They are two different times, an AM and a PM. Very weird!
In Settings --> I have:
Multiple Widgets uncheckedLock Screen Widgets --> Clock or Personal Message = ClockDual Clock OFFClock size = have tried all sizesShow Date = uncheckedShortcuts = OFF but they are showing up anyway which is fine, I usually have shortcuts there but turned off trying to get rid of one of these clocks.
I also just noticed that all the icons at the very top have ghosts and they're all blurry.
I seem to have a bug with my WL on my Note 3. Whenever I scroll my notification bar down or hold the power button to mute my phone, widgetlocker seems to overlap these menus. And its quite distracting.