[android-developers] Re: Twitter app's popup aligned with ListView item - how did they do it?

2010-06-10 Thread Nerdrow
Sorry, haven't been here in a while

This is how you can do it in a nutshell, ugly and all in java :)

LayoutParams wrapParams = new
LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT);

final LinearLayout contentView = new LinearLayout(this);
contentView.setLayoutParams(new
LayoutParams(LayoutParams.FILL_PARENT, LayoutParams.FILL_PARENT));
contentView.setOrientation(LinearLayout.VERTICAL);
contentView.setGravity(Gravity.CENTER);
setContentView(contentView);

final TextView popupContent = new TextView(this);
popupContent.setLayoutParams(wrapParams);
popupContent.setText("Replace this TextView with your
layout");

// this is the only important part
final PopupWindow popupWindow = new PopupWindow(this, null,
android.R.style.Widget_PopupWindow);
 
popupWindow.setWindowLayoutMode(ViewGroup.LayoutParams.FILL_PARENT,
ViewGroup.LayoutParams.WRAP_CONTENT);
// set according to your needs
 
popupWindow.setInputMethodMode(PopupWindow.INPUT_METHOD_NOT_NEEDED);
// set according to your needs
popupWindow.setOutsideTouchable(false);
popupWindow.setContentView(popupContent);
// this is the only important part

final Button button = new Button(this);
button.setLayoutParams(wrapParams);
button.setText("Click Me");
contentView.addView(button);

button.setOnClickListener(
new OnClickListener() {
@Override public void onClick(View v) {
   popupWindow.showAsDropDown(v);
}
}
);
popupContent.setOnClickListener(
new OnClickListener() {
@Override public void onClick(View v) {
popupWindow.dismiss();
}
}
);



On May 27, 1:23 am, ionel  wrote:
> Can you put some code how you created PopupWindows?
>
> On May 21, 10:53 pm, Nerdrow  wrote:
>
>
>
> > I used the layouts, graphics, and animation from the default Contacts
> > app, which uses separate layouts for the header, body, and footer, but
> > you can merge them all into one.  Create a PopupWindow, set that
> > layout as the contentView, then use showAsDropDown(View anchor, int
> > xoff, int yoff) to show it.  The Contacts layout has a LinearLayout
> > inside a HorizontalScrollView w/ImageViews for the two grips, so just
> > stick your content in the LinearLayout between the grips and you're
> > set.  The QuickContactWindow class has a method to set the arrows and
> > everything, copy & paste.
>
> > On May 12, 7:58 pm, Adam  wrote:
>
> > > Is there a way to get that same popup layout like they have on twitter
> > > or in the quick contacts popup? Do we just combine the top, middle,
> > > bottom image resources as backgrounds in some sort of layout, or is
> > > there a simpler way?
>
> > > On May 10, 5:16 pm, skink  wrote:
>
> > > > Mark Murphy wrote:
> > > > > westmeadboy wrote:
> > > > > > Anyone any ideas?
>
> > > > > Ummm...figure out where the item is positioned on screen, then use 
> > > > > some
> > > > > margin tricks to position theirpopupto match, I suppose.
>
> > > > if you usePopupWindowyou don't have to use margins at all - you can
> > > > position yourpopupin any (x,y) location
>
> > > > moreover: using showAsDropDown you don't even have to locate anchor
> > > > view position
>
> > > > pskink
>
> > > > --
> > > > You received this message because you are subscribed to the Google
> > > > Groups "Android Developers" group.
> > > > To post to this group, send email to android-developers@googlegroups.com
> > > > To unsubscribe from this group, send email to
> > > > android-developers+unsubscr...@googlegroups.com
> > > > For more options, visit this group 
> > > > athttp://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 android-developers@googlegroups.com
> > > To unsubscribe from this group, send email to
> > > android-developers+unsubscr...@googlegroups.com
> > > For more options, visit this group 
> > > athttp://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 android-developers@googlegroups.com
> > To unsubscribe from this group, send email to
> > android-developers+unsubscr...@googlegroups.com
> > For more options, visit this group 
> > athttp://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 android-developers@googlegroups.com
To unsubscribe from this group, send emai

[android-developers] Re: Twitter app's popup aligned with ListView item - how did they do it?

2010-06-10 Thread Yahel
Sorry to highjack the post,

Just to say "Good job", the twitter app is one of the most polished
i've seen on the market.

Keep up the good work and thanks for sharing.

Yahel

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en


[android-developers] Re: Twitter app's popup aligned with ListView item - how did they do it?

2010-05-27 Thread ionel
Can you put some code how you created PopupWindows?

On May 21, 10:53 pm, Nerdrow  wrote:
> I used the layouts, graphics, and animation from the default Contacts
> app, which uses separate layouts for the header, body, and footer, but
> you can merge them all into one.  Create a PopupWindow, set that
> layout as the contentView, then use showAsDropDown(View anchor, int
> xoff, int yoff) to show it.  The Contacts layout has a LinearLayout
> inside a HorizontalScrollView w/ImageViews for the two grips, so just
> stick your content in the LinearLayout between the grips and you're
> set.  The QuickContactWindow class has a method to set the arrows and
> everything, copy & paste.
>
> On May 12, 7:58 pm, Adam  wrote:
>
>
>
> > Is there a way to get that same popup layout like they have on twitter
> > or in the quick contacts popup? Do we just combine the top, middle,
> > bottom image resources as backgrounds in some sort of layout, or is
> > there a simpler way?
>
> > On May 10, 5:16 pm, skink  wrote:
>
> > > Mark Murphy wrote:
> > > > westmeadboy wrote:
> > > > > Anyone any ideas?
>
> > > > Ummm...figure out where the item is positioned on screen, then use some
> > > > margin tricks to position theirpopupto match, I suppose.
>
> > > if you usePopupWindowyou don't have to use margins at all - you can
> > > position yourpopupin any (x,y) location
>
> > > moreover: using showAsDropDown you don't even have to locate anchor
> > > view position
>
> > > pskink
>
> > > --
> > > You received this message because you are subscribed to the Google
> > > Groups "Android Developers" group.
> > > To post to this group, send email to android-developers@googlegroups.com
> > > To unsubscribe from this group, send email to
> > > android-developers+unsubscr...@googlegroups.com
> > > For more options, visit this group 
> > > athttp://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 android-developers@googlegroups.com
> > To unsubscribe from this group, send email to
> > android-developers+unsubscr...@googlegroups.com
> > For more options, visit this group 
> > athttp://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 android-developers@googlegroups.com
> To unsubscribe from this group, send email to
> android-developers+unsubscr...@googlegroups.com
> For more options, visit this group 
> athttp://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 android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en


[android-developers] Re: Twitter app's popup aligned with ListView item - how did they do it?

2010-05-23 Thread Emmanuel
The twitter application will become rather soon open sourced, it has
been announced by Android officials.
I think Google wants this kind of widget to become standard in Android
applications.

Emmanuel / Alocaly
http://androidblogger.blogspot.com/
http://www.alocaly.com/

On May 21, 9:53 pm, Nerdrow  wrote:
> I used the layouts, graphics, and animation from the default Contacts
> app, which uses separate layouts for the header, body, and footer, but
> you can merge them all into one.  Create a PopupWindow, set that
> layout as the contentView, then use showAsDropDown(View anchor, int
> xoff, int yoff) to show it.  The Contacts layout has a LinearLayout
> inside a HorizontalScrollView w/ImageViews for the two grips, so just
> stick your content in the LinearLayout between the grips and you're
> set.  The QuickContactWindow class has a method to set the arrows and
> everything, copy & paste.
>
> On May 12, 7:58 pm, Adam  wrote:
>
>
>
>
>
> > Is there a way to get that same popup layout like they have ontwitter
> > or in the quick contacts popup? Do we just combine the top, middle,
> > bottom image resources as backgrounds in some sort of layout, or is
> > there a simpler way?
>
> > On May 10, 5:16 pm, skink  wrote:
>
> > > Mark Murphy wrote:
> > > > westmeadboy wrote:
> > > > > Anyone any ideas?
>
> > > > Ummm...figure out where the item is positioned on screen, then use some
> > > > margin tricks to position theirpopupto match, I suppose.
>
> > > if you usePopupWindowyou don't have to use margins at all - you can
> > > position yourpopupin any (x,y) location
>
> > > moreover: using showAsDropDown you don't even have to locate anchor
> > > view position
>
> > > pskink
>
> > > --
> > > You received this message because you are subscribed to the Google
> > > Groups "Android Developers" group.
> > > To post to this group, send email to android-developers@googlegroups.com
> > > To unsubscribe from this group, send email to
> > > android-developers+unsubscr...@googlegroups.com
> > > For more options, visit this group 
> > > athttp://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 android-developers@googlegroups.com
> > To unsubscribe from this group, send email to
> > android-developers+unsubscr...@googlegroups.com
> > For more options, visit this group 
> > athttp://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 android-developers@googlegroups.com
> To unsubscribe from this group, send email to
> android-developers+unsubscr...@googlegroups.com
> For more options, visit this group 
> athttp://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 android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en


[android-developers] Re: Twitter app's popup aligned with ListView item - how did they do it?

2010-05-21 Thread Nerdrow
I used the layouts, graphics, and animation from the default Contacts
app, which uses separate layouts for the header, body, and footer, but
you can merge them all into one.  Create a PopupWindow, set that
layout as the contentView, then use showAsDropDown(View anchor, int
xoff, int yoff) to show it.  The Contacts layout has a LinearLayout
inside a HorizontalScrollView w/ImageViews for the two grips, so just
stick your content in the LinearLayout between the grips and you're
set.  The QuickContactWindow class has a method to set the arrows and
everything, copy & paste.

On May 12, 7:58 pm, Adam  wrote:
> Is there a way to get that same popup layout like they have on twitter
> or in the quick contacts popup? Do we just combine the top, middle,
> bottom image resources as backgrounds in some sort of layout, or is
> there a simpler way?
>
> On May 10, 5:16 pm, skink  wrote:
>
>
>
>
>
> > Mark Murphy wrote:
> > > westmeadboy wrote:
> > > > Anyone any ideas?
>
> > > Ummm...figure out where the item is positioned on screen, then use some
> > > margin tricks to position theirpopupto match, I suppose.
>
> > if you usePopupWindowyou don't have to use margins at all - you can
> > position yourpopupin any (x,y) location
>
> > moreover: using showAsDropDown you don't even have to locate anchor
> > view position
>
> > pskink
>
> > --
> > You received this message because you are subscribed to the Google
> > Groups "Android Developers" group.
> > To post to this group, send email to android-developers@googlegroups.com
> > To unsubscribe from this group, send email to
> > android-developers+unsubscr...@googlegroups.com
> > For more options, visit this group 
> > athttp://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 android-developers@googlegroups.com
> To unsubscribe from this group, send email to
> android-developers+unsubscr...@googlegroups.com
> For more options, visit this group 
> athttp://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 android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en


[android-developers] Re: Twitter app's popup aligned with ListView item - how did they do it?

2010-05-12 Thread Adam
Is there a way to get that same popup layout like they have on twitter
or in the quick contacts popup? Do we just combine the top, middle,
bottom image resources as backgrounds in some sort of layout, or is
there a simpler way?

On May 10, 5:16 pm, skink  wrote:
> Mark Murphy wrote:
> > westmeadboy wrote:
> > > Anyone any ideas?
>
> > Ummm...figure out where the item is positioned on screen, then use some
> > margin tricks to position theirpopupto match, I suppose.
>
> if you use PopupWindow you don't have to use margins at all - you can
> position yourpopupin any (x,y) location
>
> moreover: using showAsDropDown you don't even have to locate anchor
> view position
>
> pskink
>
> --
> You received this message because you are subscribed to the Google
> Groups "Android Developers" group.
> To post to this group, send email to android-developers@googlegroups.com
> To unsubscribe from this group, send email to
> android-developers+unsubscr...@googlegroups.com
> For more options, visit this group 
> athttp://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 android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en


Re: [android-developers] Re: Twitter app's popup aligned with ListView item - how did they do it?

2010-05-10 Thread skink


Mark Murphy wrote:
> westmeadboy wrote:
> > Anyone any ideas?
>
> Ummm...figure out where the item is positioned on screen, then use some
> margin tricks to position their popup to match, I suppose.
>

if you use PopupWindow you don't have to use margins at all - you can
position your popup in any (x,y) location

moreover: using showAsDropDown you don't even have to locate anchor
view position

pskink

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en


Re: [android-developers] Re: Twitter app's popup aligned with ListView item - how did they do it?

2010-05-10 Thread Mark Murphy
westmeadboy wrote:
> Anyone any ideas?

Ummm...figure out where the item is positioned on screen, then use some
margin tricks to position their popup to match, I suppose.

You can see a really crude equivalent of that here, just aiming for
putting something on the upper or lower half of the screen:

http://github.com/commonsguy/cw-advandroid/tree/master/Maps/EvenNooerYawk/

-- 
Mark Murphy (a Commons Guy)
http://commonsware.com | http://github.com/commonsguy
http://commonsware.com/blog | http://twitter.com/commonsguy

Android App Developer Books: http://commonsware.com/books

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en


[android-developers] Re: Twitter app's popup aligned with ListView item - how did they do it?

2010-05-10 Thread westmeadboy
Anyone any ideas?

On May 9, 4:33 pm, westmeadboy  wrote:
> In the official Twitter app, in the Tweets activity, if you click on
> the small down arrow (right side of each tweet entry), a really nice
> popup appears just above or below the entry.
>
> How did they do this (i.e. position the popup alongside the relevant
> item)?
>
> --
> You received this message because you are subscribed to the Google
> Groups "Android Developers" group.
> To post to this group, send email to android-developers@googlegroups.com
> To unsubscribe from this group, send email to
> android-developers+unsubscr...@googlegroups.com
> For more options, visit this group 
> athttp://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 android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en