Boni2k wrote:Efefes wrote:Hello. I'm new to android and somewhat new to programming as well, so I have a few questions after trying out this tutorial.
1. I got the basic version of the tutorial working, but however the images are slightly overlapping. How do I cease that from happening? I want the next picture to start 1 pixel away from the previous one.
2. I want to add onClick functionality, but using the previous sample made me unable to use the scrolling anymore.
3. I want to add text below the gallery which changes depending on which picture is chosen.
I'm newbieish to this stuff and couldn't figure it out on my own with the tutorials, so any help is greatly appreciated. Thanks in advance and thanks for the tutorial
1. use .setSpacing(pixel) for your gallery
2. Take a look here:
http://developer.android.com/guide/tuto ... llery.html3. it can be combined your 2. point
Thank you.
1. I got this to work with the hello-gallery tutorial in developer.android.com but not sure how to use it with this tutorial. Could you explain the specific piece of code? I'm honestly just starting out with programming, and having difficulties with the most basic things.
2. I went through this, but there's one thing puzzling me.
public ImageAdapter(Context c) {
mContext = c;
TypedArray a = obtainStyledAttributes(R.styleable.HelloGallery);
mGalleryItemBackground = a.getResourceId(
R.styleable.HelloGallery_android_galleryItemBackground, 0);
a.recycle();
}
What does this do? whats 'styleable' ? this piece of code is giving me errors for missing that, how should I go on about adding it and what should I add there? a background?
3. I got the onclick thing working with Toast, but I still can't figure out how to put normal text below there, and how to get the trigger from the "current image". I'd like to add a few lines of text for each picture, and Toast is not exactly the tool I want to use with that. I went through the TextView methods, but still can't quite figure out how to use it as I wish, how to place my text in certain coords or below an object.
Sorry for having such limited comprehension and thanks for help, it's greatly appreciated.