Android :: Arbitrary Shape ImageView That Respond Events?
Aug 14, 2009I need some arbitrary shape imageView that can respond events. How can I do that?
View 3 RepliesI need some arbitrary shape imageView that can respond events. How can I do that?
View 3 RepliesI'd like to do something rather simple - I'd like to have an image on the screen and resize it to be bigger when the user clicks on it. I have figured out how to respond to a click by making the imageview bigger (It's a simple call to "setMinimumWidth" and "request Layout"). But that resizes the imageView - not the image in the view... Is there a simple way to do this?
View 2 Replies View RelatedI want to have a elmenent with a 2 color border outline. I can do a single color outline using the element, but this only allows me to draw a single line. I tried using 2 elements within my but that didnt work either. Is there a way to either draw a shape within a shape or draw 2 lines around my shape (which has rounded corners btw).
View 3 Replies View RelatedI'm trying to build an android application that features a graphical display drawn within a RelativeLayout. I want to place "+" and "-" buttons next to several of the parameters, which are drawn at various points on the canvas. The positions are free-form don't seem to conform to any of the standard XML layouts.I know how to create the buttons programmatically, but I don't know how to place them over the canvas where I need them to be. I'm assuming that this would be done in the view thread's doDraw() method, after all the graphics have been drawn, but how?
View 2 Replies View RelatedIt seems that the Android resource compiler does not take into account linked folders (in Eclipse sense) in the assets folder. Question - is there a way to forcibly designate a folder of my choice as Android project assets? Short of copying or hardlinking into project assets, I mean.
View 1 Replies View RelatedI wish my alert dialog can add/remove items arbitrary, but I looked for the sdk reference but nothing method can use, is somone knows how to do?
View 2 Replies View RelatedIs there a way to write to the /assets direcory and save arbitrary files to it? I am intending to download a HTML page which should be updated from time to time. If no network connection is available it should be taken out of the assets directory. I know I can reference fils in here using the file:///android_asset/ base URL, but can I write to it, too?
View 2 Replies View RelatedI believe I know the basics and have successfully published a nice graphical game (Tairu). I know about inflating an xml layout and instantiating views that work.
For my current project, I really just want something similar to the Windows 'DrawText' function where it will draw a bit of a text inside an arbitrary rectangle of the surface, and do word wrap within that rectangles boundaries. That's what I really WANT, but I can't find any form of drawText that will wrap.
So, while that's what I WANT, I can accept the thought of programmatically instantiating a TextView (which wraps beautifully). But I still need to be able to provide the rectangle, which is highly dynamic. (which is why I want to call a form of drawText inside of my onDraw method). In this particular case, I have something which is static to a particular view instance (I mean, the View becomes visible, the position is set, and does not change after that. but the text position is dependent on game state and cannot be pre-determined inside an XML layout). So in this one case, I could afford the expense of runtime recalculation of the layout when the view is displayed.
OK, fine. So I do something like this:
CODE:......
Pretend you didn't see 'AbsoluteLayout' there, I am desperate and have tried all possible layout classes
main_frame is defined in my main XML layout (it is the outermost layout, fills the parent, and, as I said, I've tried all the offered layouts)
With this code, the textView appears, but along the top of the layout, and not using the width I provided either.
Adding, out of desperation.
CODE:.......
makes no difference. In fact, so far, NOTHING has made any difference. So I thought, ok, while this seems like a useful thing to be able to do, I can accept if it can't. I accept that it is impossible to provide dimensions in advance and that you have to override the measure and layout callbacks then requestLayout and in your overrides, force the final layout for the TextView.
Of course, that is completely unacceptable for my FIRST desire (a drawText that wraps to a rectangle, called from onDraw as needed). But the point is I feel something like that OUGHT to work, and it doesn't, so clearly this is MY fault.
Getting back to what I WANT, I guess I can do it myself by repeated calls to measure text and parsing the string for spaces until I get the N characters which fit on the first line, then repeat for additional lines, calling a normal drawText for each line (and using textMetrics to determine the vertical offset to the next line.)
But why wouldn't that method already exist? I promise not to fill the screen with a zillion calls, and/or to cache pre-rendered text on some bitmap somewhere if antialiased drawText is too expensive to repeat frequently.
I have a listlayout with items in it that looks like this:
There is first an ImageView (the light) and then two textViews. All of this inside a TableLayout. (source here: http://code.google.com/p/switchctrl/source/browse/trunk/android/res/layout/device_switch.xml)
I want to have a rotating animation of a loading indicator Ontop of this light when this particular device (light) performs an action or an action is performed on it.
How do I put an animation ontop of this light imageview?
As an experiment, I would like to use the platform key of my custom built Android platform to sign an arbitrary APK, that is built via the NDK. What is the process to go about doing this?
View 2 Replies View RelatedI want to have a View pop in at the bottom of the page exactly like the software keyboard view does in the compose section of the Mms app.It slides in from the bottom, as if it's being added to a vertically oriented LinearLayout, only making the ListView smaller.It becomes a part of the current layout instead of popping up over the top of it.I'd like to to this exact thing with my own custom View.
View 1 Replies View RelatedHow can I setup an method to be called whenever Intent.ACTION_BATTERY_CHANGED is raised? Do I have to subclass BroadcastReciever? Or can I use a method to hook up the action to a method.
View 1 Replies View RelatedI have a basic animation of a button after it is pressed currently in my application. After the button finishes animating, I can no longer click on it. It doesn't even press with an orange highlight.
View 2 Replies View RelatedI am creating a context menu in separate class from the listview, because the contextmenu will be access by several listviews in different classes. Whenever I long-click the listview, contextmenu pops up, but nothing happens when the options were chosen. Tried to look at logcat message and it said something like this:
Window already focused, ignoring focus gain of: com.android.internal.view.IInputMethodClient$Stub$Proxy@43c488f8
Any idea what really causing this problem? cause it works perfectly fine if i put the contextmenu on the same class as listview.
Just downloaded Shapewriter for My DInc. And it is awesome. All those waiting for Swype should give this a try because its pretty Incredible.
View 7 Replies View RelatedAnyone know where I can find this? I had it on my phone awhile ago but had to wipe and could not find it again in the market. IMO it was a tad bit better then Swype. Both great keyboards, I just liked that one better. If anyone could provide any info that would be great. Thank you.
View 2 Replies View RelatedHow can I draw a shape (e.g. circle, rectange) that has different stroke and fill colors? Eg. A circle with green perimeter, but black inner fill.
View 3 Replies View RelatedWhere is there information about the syntax of <shape> xml files. These can be used to define 2D graphics as I understand it. There are few spotty examples in the samples directory but that is all I have found.
View 7 Replies View RelatedIs there any way of defining a triangle in a shape item though a XML definition? It seems there is only rectangle, oval, line and ring. Why not a triangle?
View 4 Replies View RelatedI have a button on my app that I want to change the color of during different states of my application. However when I call btn.setBackgroundColor(Color.GREEN); the shape of the button changes. The rounded edges go away and I get a flat looking rectangle that is green. Is there a reason the shape is changing? Is there a a way to change the button color without the shape changing?
View 4 Replies View RelatedI would like to have a shape that has border only on 3 sides: top, left and right, i.e. I want bottom to be open. How can I achieve that defining shape in XML? Currently I have a normal 4 side border using the following shape XML definition:
<?xml version="1.0" encoding="utf-8"?> <shape xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="fill_parent" android:layout_height="fill_parent" >
<solid android:color="#FFE8F0F8" />
<stroke android:width="1dp" android:color="#808480" />
<padding android:left="1dp" android:top="1dp" android:right="1dp" android:bottom="1dp" /> </shape>
I really appreciate if someone can help me with using how to use shape drawable as my background xml for my view. This is what I tried: But I never get the color. Android always gives me black text on white background, regardless what color attribute I put.
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<stroke android:width="1dip" android:color="#FBBB" />
<solid android:color="#6000"/>
</shape>.............................
I've created a custom toolbar using a gradient inside a shape. It looks very nice, but since we only have the option for 3 colors (startColor, centerColor, endColor) it looks very round. I would like to do a glass effect, which requires a sharp change in color in the middle. Basically I need 4 colors (startColor, justabovecenterColor, justbelowcenterColor, endColor). Now I could have two shapes sitting on top of each other to get this effect, but I don't want to do this. I'm getting into some tricky UI customization here and that would be very difficult to manage on different sized screens.
View 1 Replies View RelatedI'm trying to draw a rounded rectangle with a border around it using a class that extends ShapeDrawable (see here) and everything is working except that the shapedrawable seems to be cutting off some of the border because the shape itself doesn't extend outside those bounds. Is there not some way to offset where the shapedrawable starts drawing so that there is some padding between the bounds of the shape itself and the canvas? I have tried both ShapeDrawable.setBounds to larger than the intrinsic size of the shape and ShapeDrawable.setPadding but don't seem to be getting anywhere. Should I be subclassing Drawable instead?
View 1 Replies View RelatedInstead of using in my layout ImageView and TextView I am now adding the image like this:
text.setCompoundDrawablesWithIntrinsicBounds(0, mImagesId[position], 0, 0);
In order to add border to the ImageView I defined a shape xml that I am using as a BackgroundResource.
How can I now add the shape to the TextView image up compound ?
I'm using xml file to define progress bar. I defined padding on background shape. But this setting will be sometimes displayed correctly, sometimes not. So If I start my application or Activity with progressbar inside, there will be correctly displayed progressbar with background and 'padded' progress. Then I close my application and start it again, and, progressbar is displayed without padded background, on next start will be displayed correctly and son on ... Could you please advice possible reasons for this?
xml file:..................
I set an ImageButton's click listener via setOnClickListener(), but it doesn't respond to trackball clicks like a regular Button.
View 1 Replies View RelatedMy Activity implements OnItemSelected listener for a spinner. It has the interesting problem of firing off the onItemSelected callback when the activity shows. So I used a flag hack to solve it (I hate it, but at this point I just want the app to work).
Strangely enough, even though the callback gets called right at activity start, my actual touch selections don't work. I can touch the list, open it, see the strings from the array adapter, and even touch it to make it dismiss - but the callback is never called.
My code:
CODE:...........
In onCreate():
CODE:..............
The callback:
CODE:................
The toast is shown right when the activity is shown, but when I select items in the spinner, the spinner dismisses and no toast is displayed again (not to mention the rest of the code in the callback fails to execute).
HTC Desire PC Sync issues. PC & Desire connect when Sync initiated from either the phone or desktop icon. PC Sync will display my phone setting and information but it will not sync. The Sync button in Green in the top right hand corner of the Sync program does not respond to mouse click.
Have installed HTC Sync 3.0, uninstalled, reinstalled it - from the HTC website, removed other old mobile applications ie Nokia. I have changed the USB ports etc etc. It has worked once, when I first installed the software and not since then. Also I have USB debugging activated and the phone defaulted connection type: HTC SYNC. Help please as this issue has been active now since I got the Desire 3 weeks ago.
I am using commitva z71 category phone. (motorola quench xt3 xt502).
I had been using cyanogenmod roms on it. presently i have CM 7.1 EAV 7.2. The roms usually came with ADW launcher as default. But one problem I have been facing is that some times my phone does not respond to press of any button, not even power button after ending a call. The screen however goes off and does not light up.
I have to either remove the battery, replace it and restart or I have to make a call to my phone from another phone. When I give a missed call, the phone gets activated. But when I press Menu button, it brings up the keyboard instead of Menu.
This problem has been persisting whichever version of CM Rom I have been using.
The problem aggravates when I use Go Launcher as my default launcher by using Launcher Switcher. When I use ADW as default lanucher but have Go Launcher also on my phone, sometimes the defaults are cleared and I am asked to choose the launcher to finish the task of closing phone app.
Initially, I thought this was the problem of default phone app. So I tried dialer one from play store, but to no avail.
Is there a way to delete the ADW launcher that comes with the custom ROM?