Android theming language - Galaxy Y GT-S5360 and Duos 6102 Q&A, Help & Troubl

Hey guys good days
I just want to ask maybe this is off topic but i just can apply the code provided by devs without understanding what the mean of it.
So i want to know where do you guys learn it ?
Example what is image view, frame layout, linear layout and so on.
If you learn it from book, can i know the title of it ?
TIA

Try
http://developer.android.com/reference/packages.html
http://developer.android.com/reference/android/widget/LinearLayout.html
and specially
http://forum.xda-developers.com/coding/education
ImageView = its imageview the one that containing image like a pictureFrame.
LinearLayout = its a linearLayout. For example you want to put imageView inside a LinearLayout
its like putting a pictureFrame in a wall.
LinearLayout Orientation = vertical - make the child vertically arrange.
for example you have three picture frames in a wall and you add androidrientation="vertical" the picture frame will be aligned verticaly same with androidrientation="horizontal" this will arrange the child horizontally.
FrameLayout = like LinearLayout but this layout makes you put Layout in top of other Layout.
:good::good::good::fingers-crossed::fingers-crossed::fingers-crossed::good::good::good:​

Related

[Q] using getSurfaceFrame to get display width/height?

So I'm trying out making a live wallpaper and I'm using the sample code provided in the SDK for the cube live wallpaper
I wanted to use this code to get the height/width of the display
Code:
@Override
public void onCreate(SurfaceHolder surfaceHolder) {
super.onCreate(surfaceHolder);
Rect frame = getSurfaceHolder().getSurfaceFrame();
float width = frame.width();
float height = frame.height();
// By default, we don't get touch events, so enable them.
setTouchEventsEnabled(true);
}
and if you're wondering about the context of the code, just look at this sample
Unfortunately, when I run this code, the width and height return as 0, though if I put this in onVisibilityChanged, the correct values are returned, why is this and where should I put it?
Also, when I do get the display width/height, it includes the real estate behind the notification bar as well. Is there a way I can get the width/height area of everything excluding the notification bar?

[Q] creating a bitmap

how do I create a bitmap from a png image?
This turns a png into a bitmap:
Bitmap bmp = BitmapFactory.decodeResource(activity.getResources(), R.drawable.myPNGimage);
I think your other post asked about drawing images onto the screen. To do this, you need an object that you want to "draw onto".
So in this example, lets say you want to draw "bmp" onto "backgroundBmp". (Pretend "backgroundBmp" is a 400x400 pixel image)
Canvas canvas = new Canvas(backgroundBmp); // This creates a canvas to work with, thats the size of backgroundBmp (400x400)
Now I can draw a bitmap onto it, by doing:
canvas.drawBitmap(bmp, x, y, null); // This draws bmp at (x,y) coordinates on the canvas.
Take a look at the Lunar Lander and Jet Boy sample applications at developer.android.com.

[Q] Resize a linearlayout in an appwidget from code

is it possible? I have created a unique sort of clock as an AppWidget that has horizontal bars that should indicate minutes and hours. How could I change the width of the LinearLayout used as a bar from the onUpdate() method? I tried RemoteViews but that Views seems to lack a setWidth() method...
appwidgets are unlike anything else in android. they cannot directly alter, add, or remove items from a layout. the only thing that can be altered is text in a textView, the visibility of a view inside the layout, and the value of any of the views inside the layout, like int, bool, float, images, progress bars.
you can however change the view entirely, as in change to another layout.xml
you'll have to be creative to be able to find a way for your widget to change. i think the setViewVisibility() method could help. if you layout every piece that you need and selectively set their visibility based on the state of your widget.
here is a kinda related topic
http://stackoverflow.com/questions/...-dynamically-in-an-android-widget-api-level-3
Hmm, so if I would do 60 linearlayouts and place them next to each other, and say the clock is 13:30, I set the first 30 layouts visible? How would that many views affect performance???
Not sure. Probably wouldn't be good with that many.
This is where you'll have to be creative. Might be good to have one image view and have a bunch of images of the bar at different stages. Though that would require alot of images.
Just remember you can change the content of a view but you cant add another view "on the fly". Its a tricky thing to deal with in an appwidget. Ive been trying to make a widget that displays a tag cloud of your gmail inbox and ive had to use a textView as a wrapper to display the generated html for the cloud instead of adding new textViews for each tag.
From something awesome

Ball game - chaning ball position

I am making simple ball game and l have problem.I can't change position of Ball. I tried:
1. SetX() and setY() but lower APIs aren't supported.
2. Params and margins but when I move it left or right, the whole activity content is moving with it. Up and down moving is working fine. (Activity will have 10 ImageViews)
3. Android animations - Problem is that I can't get coorinates (getLeft(), getTop()) during the animation.
4. Canvas and draw elements - I change position of image with onDraw() and invalidate() functions but when I but backgorund and all other images (as bitmaps) it is very slow.
Can you give to me any ideas or suggestions? Thanks in advance.
Can you post the code? What do you exactly want to be done, there can be many different "ball games". You want to change the position of a bitmap or circle on the screen create x and y variables, draw bitmap or circle using them and if they change, the object will be drawn elsewhere

[Q] Overlay list item when it's pressed

I want to add a layer when list item's pressed. The layer will overlap any object in list item (imageview, textbox, layout background, ...). It's exactly like Google apps (Play, Youtube,...), when you press or hold an item, you can see it. My app has some complex list items, so using background seletor is not good enough.
Thank you.
Looking at the play en youtube app, it seems like they only change the backgroundcolor and don't add an overlay.
If you have created your own row layouts and added them to the list, you can get the most outer viewgroup from this layout in your onItemClicked method.
Just change the background of this viewgroup.
Code:
onItemClicked(View v) {
[INDENT]v.setBackground(your background);[/INDENT]
}
If you do want an overlay instead of another background, you can wrap your row layout in a frame layout with an invisible overlay. Then just change the visibility in the onItemClicked method.
Code:
onItemClicked(View v) {
[INDENT]View overlay = (View) v.findViewById(R.id.overlay);
overlay.setVisibility(View.VISIBLE);[/INDENT]
}

Categories

Resources