*> how do you get the image at the center when selected or scrolling and have its text displayed?*
I'm not sure I know what you mean... By definition a Gallery widget is "A view that shows items in a center-locked, horizontally scrolling list." That is taken directly from the docs for the Gallery: http://developer.android.com/reference/android/widget/Gallery.html On Fri, Mar 4, 2011 at 3:22 AM, monty <[email protected]> wrote: > how do you get the image at the center when selected or scrolling and > have its text displayed? > > On Mar 3, 7:56 pm, Justin Anderson <[email protected]> wrote: > > It returns the text that should be displayed displayed for the item at > the > > given position > > On Mar 3, 2011 4:27 AM, "monty" <[email protected]> wrote: > > > > > What does the "getItemText(int pos) " method in your code do? > > > > > On Mar 1, 7:26 pm, Justin Anderson <[email protected]> wrote: > > >> The way I implemented mine in AppSwipe! is a little complex... Here > is a > > >> quick overview of what I did: > > > > >> - I subclassed RelativeLayout and created a new class called > > TitledGallery > > >> that holds the Gallery and two TextViews (for reusability reasons > because > > I > > >> have up to 5 of these in the main display) > > >> - My image adapter has the following method: public String > > getItemText(int > > >> pos) > > >> - My getView method only deals with the ImageView in the Gallery... It > > does > > >> not change the text in the view > > >> - I implemented onItemSelectedListener and put this listener on my > > Gallery > > >> - I update the text in OnItemsSelectedListener.onItemSelected() and > > >> OnItemSelectedListener.onNothingSelected() > > > > >> Hope that helps! > > > > >> On Tue, Mar 1, 2011 at 4:29 AM, monty <[email protected]> wrote: > > >> > Sorry the apps name is AppSwipe > > > > >> > On Mar 1, 3:53 pm, monty <[email protected]> wrote: > > >> > > Actually my requirement is that when when the gallery is scrolled > > >> > > there will be a TextView at bottom of Gallery that will display > the > > >> > > name of the image or some information related to that image.Now i > > want > > >> > > that when i scroll and stop the Gallery the image in the middle of > > >> > > Gallery should have its data displayed in the TextView.You can > check > > >> > > the above code i have posted. > > >> > > There is an "AppAwipe" app that does this.Check it out and you > will > > >> > > understand my requirement. > > >> > > Please let me know if any solution. > > > > >> > > On Mar 1, 3:29 pm, Gergely Juhász <[email protected]> wrote: > > > > >> > > > sorry for the syntax: > > >> > > > What if you use TextViews instead of using ImageViews? > > > > >> > > > On 1 March 2011 11:28, Gergely Juhász <[email protected]> > wrote: > > > > >> > > > > What is you use TextView instead of using image views. > > >> > > > > TexView has an attribute android:drawableTop. With that you > can > > >> > simple > > >> > > > > draw an image above the text. > > >> > > > > Or you can use a vertical linear layout as the view element > (wtih > > an > > >> > > > > image and a text). > > > > >> > > > > On 1 March 2011 11:13, monty <[email protected]> wrote: > > >> > > > >> yes.. i have checked that code.But here he is not displaying > any > > >> > text > > >> > > > >> when the Gallery is scrolled.So any solution?Am i missing > some > > API > > >> > or > > >> > > > >> something in the code i sent you.? > > > > >> > > > >> On Mar 1, 2:59 pm, Gergely Juhász <[email protected]> > wrote: > > >> > > > >>> what do you think about this: > > >> >http://www.inter-fuser.com/2010/02/android-coverflow-widget-v2.html > > >> > > > >>> it's a nice cover flow using the gallery > > > > >> > > > >>> On 1 March 2011 10:41, monty <[email protected]> wrote: > > > > >> > > > >>> > Yes the data displaying is correct.The parsing is fine.The > > only > > >> > issue > > >> > > > >>> > is its not working like your app where you are > highlighting > > the > > >> > centre > > >> > > > >>> > item of the Gallery and displaying it.Could u then please > > give a > > >> > brief > > >> > > > >>> > view of yourcode.Are you also using getView() and > > implementing > > >> > the > > >> > > > >>> > code? > > > > >> > > > >>> > On Mar 1, 2:35 pm, Justin Anderson <[email protected] > > > > >> > wrote: > > >> > > > >>> >> Well... I didn't notice anything that wrong with your > code > > (but > > >> > I may have > > >> > > > >>> >> missed something). Have you checked your parsing code to > > make > > >> > sure that the > > >> > > > >>> >> data is accurate once you've parsed the xml? > > > > >> > > > >>> >> On Tue, Mar 1, 2011 at 2:23 AM, monty < > [email protected] > > > > >> > wrote: > > >> > > > >>> >> > Hi > > >> > > > >>> >> > Here clip_model is an arraylist that will hold the data > of > > xml > > >> > we > > >> > > > >>> >> > parse.And here i am getting the data for from that > > arraylist > > >> > using the > > >> > > > >>> >> > "position" variable. > > >> > > > >>> >> > Also i went thru your app ,thats exactly what i want > for > > my > > >> > app. > > > > >> > > > >>> >> > On Mar 1, 1:33 pm, Justin Anderson < > [email protected]> > > >> > wrote: > > >> > > > >>> >> > > What is clip_model? > > > > >> > > > >>> >> > > On Tue, Mar 1, 2011 at 12:32 AM, monty < > > >> > [email protected]> wrote: > > >> > > > >>> >> > > > Hi, > > >> > > > >>> >> > > > Following is part of code from the Activity.Hope > the > > code > > >> > will be > > >> > > > >>> >> > > > clear enough for you to understand.Please let me > know > > how > > >> > to resolve > > >> > > > >>> >> > > > this issue.It would be really helpful. > > > > >> > > > >>> >> > > > setContentView(R.layout.chapter_clips); > > > > >> > > > >>> >> > > > //will have Gallery,WebView and TextView.The > WebView > > and > > >> > TextView > > >> > > > >>> >> > > > data has to be changed when i scroll the Gallery,so > i > > call > > >> > the Webview > > >> > > > >>> >> > > > and TextView in the getView() of the adapter. > > > > >> > > > >>> >> > > > Gallery g = (Gallery) findViewById(R.id.gallery); > > >> > > > >>> >> > > > g.setAdapter(new > > >> > ImageAdapter(this));//calling the > > >> > > > >>> >> > Adapter > > >> > > > >>> >> > > > class > > >> > > > >>> >> > > > g.setAnimationDuration(3000); > > >> > > > >>> >> > > > g.setOnItemSelectedListener(this); > > > > >> > > > >>> >> > > > public class ImageAdapter extends BaseAdapter { > > >> > > > >>> >> > > > int mGalleryItemBackground; > > > > >> > > > >>> >> > > > public ImageAdapter(Context c) { > > >> > > > >>> >> > > > mContext = c; > > > > >> > > > >>> >> > > > } > > > > >> > > > >>> >> > > > public int getCount() { > > > > >> > > > >>> >> > > > return > > >> > mchaptermodel.clip_model.size(); > > >> > > > >>> >> > > > } > > > > >> > > > >>> >> > > > public Object getItem(int position) > { > > >> > > > >>> >> > > > return position; > > >> > > > >>> >> > > > } > > > > >> > > > >>> >> > > > public long getItemId(int position) > { > > >> > > > >>> >> > > > return position; > > >> > > > >>> >> > > > } > > > > >> > > > >>> >> > > > public View getView(int position, > View > > >> > convertView, > > >> > > > >>> >> > > > ViewGroup > > >> > > > >>> >> > > > parent) { > > > > >> > > > >>> >> > > > LayoutInflater > > > > > lInflater=(LayoutInflater)mContext.getSystemService(Context.LAYOUT_INFLATER_SERVICE); > > > > >> > > > >>> >> > > > convertView = > > >> > lInflater.inflate(R.layout.item, > > >> > > > >>> >> > null, > > >> > > > >>> >> > > > false); //this "item" xml contains imageview to > be > > >> > displayed on > > >> > > > >>> >> > > > Gallery > > > > >> > clipimagename=mchaptermodel.clip_model.get(position).getClipimage(); > / > > >> > > > >>> >> > > > *Getting all data from parsed xml */ > > > > >> > > cliptitle=mchaptermodel.clip_model.get(position).getClipTitle();//for > > >> > > > >>> >> > > > textview > > > > >> > cliptext=mchaptermodel.clip_model.get(position).getClipText();//for > > >> > > > >>> >> > > > webview > > > > >> > > > >>> >> > > > try { > > > > >> > > > >>> >> > > > clipimagename=clipimagename.replaceAll(".png",""); > > >> > > > >>> >> > > > galleryimage= > > > > >> > getResources().getIdentifier(clipimagename,"drawable",package_name); > > > > >> > > > >>> >> > > > } catch (Exception e) { > > >> > > > >>> >> > > > Log.i("Drawing > > Image...","" > > >> > ); > > >> > > > >>> >> > > > } > > > > >> > > > >>> >> > > > ImageView i= > > >> > > > >>> >> > > > > (ImageView)convertView.findViewById(R.id.imageview); > > > > >> > > > >>> >> > > > i.setImageResource(galleryimage) ; > > >> > > > >>> >> > // > > >> > > > >>> >> > > > setting the image on Gallery > > >> > > > >>> >> > > > i.setAdjustViewBounds(true); > > > > i.setScaleType(ScaleType.FIT_CENTER); > > > > > > > > >> > > > >>> >> > > > /*The TextView and Webview defined below has to be > > changed > > >> > when the > > >> > > > >>> >> > > > Gallery is scrolled which is working fine but as i > > said i > > >> > want the > > >> > > > >>> >> > > > image in Gallery which comes in center its data > should > > be > > >> > displayed on > > >> > > > >>> >> > > > TextView and Webview and not the corner item > visible*/ > > > > >> > > > >>> >> > > > TextView > > >> > tv1=(TextView)findViewById(R.id.title); > > >> > > > >>> >> > > > tv1.setTextSize(16); > > >> > > > >>> >> > > > tv1.setText(cliptitle); > > >> > > > >>> >> > > > tv1.setTextColor(Color.BLACK); > > > > >> > > > >>> >> > > > WebView chap_description = (WebView) > > >> > > > >>> >> > > > findViewById(R.id.webview); > > > > >> > chap_description.loadDataWithBaseURL("file:/// > > > > >> > > android_asset/demonew.html",String.format(htmlContent,cliptext),"text/ > > >> > > > >>> >> > > > html", "utf8", ""); > > > > >> > > > >>> >> > > > return convertView; > > >> > > > >>> >> > > > } > > >> > > > >>> >> > > > } > > > > >> > > > >>> >> > > > On Feb 28, 10:09 pm, Justin Anderson < > > >> > [email protected]> wrote: > > >> > > > >>> >> > > > > Well... what does your code look like? > > > > >> > > > >>> >> > > > > On Sun, Feb 27, 2011 at 10:32 PM, monty < > > >> > [email protected]> > > >> > > > >>> >> > wrote: > > >> > > > >>> >> > > > > > Hi > > >> > > > >>> >> > > > > > I am developing an application where i need to > > >> > achieive coverflow > > >> > > > >>> >> > > > > > animation using android Gallery.When i scroll > the > > >> > Gallery i need to > > >> > > > >>> >> > > > > > display the data of the middle item in the > Gallery > > in > > >> > a TextView. > > >> > > > >>> >> > > > > > But instead when i scroll and stop the Gallery > > ,the > > >> > TextView prints > > >> > > > >>> >> > > > > > the last item of Gallery visible on the device > > .and > > >> > not the middle > > >> > > > >>> >> > > > > > one. > > >> > > > >>> >> > > > > > How do i acheive this?Do i need to write some > > logic or > > >> > will it work > > >> > > > >>> >> > > > > > with some > > > > ... > > > > read more » > > -- > You received this message because you are subscribed to the Google > Groups "Android Developers" group. > To post to this group, send email to [email protected] > To unsubscribe from this group, send email to > [email protected] > For more options, visit this group at > http://groups.google.com/group/android-developers?hl=en > -- You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/android-developers?hl=en

