Works perfectly. 9-patch with transparency set for Stretch and Content is exactly right. Ended up applying my 9-patch to the Dialog itself, instead of the View inside the inflated Dialog's contents. This code below works now. Thanks again.
mDialog = new Dialog(mContext); mDialog.requestWindowFeature(Window.FEATURE_NO_TITLE); mDialog.setContentView(textEntryView); mDialog.getWindow().setBackgroundDrawable(getResources().getDrawable(R.drawable.tenth)); mDialog.show(); On Apr 3, 7:39 pm, Nick Longinow <nicklongi...@gmail.com> wrote: > Perfect. I found some good examples of subclassing AlertDialog, but > this may be alot easier to do. I'll take my 9-patch and apply it to a > Dialog. thanks > > On Apr 3, 6:28 pm, Dianne Hackborn <hack...@android.com> wrote: > > > > > Oh wait, you are using AlertDialog? Why? AlertDialog is for making > > standard-looking dialogs. If you just want a dialog you can use Dialog and > > customize its content as desired. > > > On Sun, Apr 3, 2011 at 3:04 PM, Nick Longinow <nicklongi...@gmail.com>wrote: > > > > HierarchyViewer says that the border is being drawn by the AlertDialog > > > code itself. ie, it's coming from an object called "FrameLayout, with > > > ID = id/customPanel". > > > > So, to solve this is it necessary to extend AlertDialog? Or is that > > > overkill? > > > > On Apr 3, 12:12 pm, Dianne Hackborn <hack...@android.com> wrote: > > > > Use hierarchyviewer to look at your view hierarchy and see what is > > > drawing > > > > each element. > > > > > On Sun, Apr 3, 2011 at 5:10 AM, Nick Longinow <nicklongi...@gmail.com > > > >wrote: > > > > > > Taking a step back here. I think if I solve the Dialog itself, the > > > > > Window background drawable may not be an issue. Saying that because > > > > > once I created the 9-patch with correct transparency and Content and > > > > > Patch settings, it looks as it should. > > > > > > So, trying to get the dialog layout (view) right first. > > > > > > Code: > > > > > // 1 - specify the layout (pretty simple stuff) > > > > > <?xml version="1.0" encoding="UTF-8"?> > > > > > <LinearLayout xmlns:android="http:// > > > > > schemas.android.com/apk/res/android" > > > > > android:id="@+id/layout_root0" > > > > > android:layout_width="fill_parent" > > > > > android:layout_height="fill_parent" > > > > > android:background="#fff80000" <!-- gives me a > > > > > red > > > bar > > > > > at the top of the dialog --> > > > > > > <ListView > > > > > android:id="@+id/shareList" > > > > > android:layout_width="fill_parent" > > > > > android:layout_height="fill_parent" > > > > > android:background="@drawable/tenth" <!-- my > > > > > 9-patch. > > > > > Correctly > > > > > displays as expected --> > > > > > > </ListView> > > > > > </LinearLayout> > > > > > > // 2 - inflate and populate the View > > > > > LayoutInflater factory = LayoutInflater.from(this); > > > > > final View textEntryView = factory.inflate(R.layout.bc, > > > > > null); > > > > > ListView shareList = > > > > > (ListView)textEntryView.findViewById(R.id.shareList); > > > > > shareList.setAdapter(gla); > > > > > > // 3. Now, display the dialog (turn off the title > > > > > bar) > > > > > AlertDialog.Builder builder = new AlertDialog.Builder(this); > > > > > builder.setCancelable(true) > > > > > .setView(textEntryView); > > > > > > mAlert = builder.create(); > > > > > mAlert.requestWindowFeature(Window.FEATURE_NO_TITLE); > > > > > mAlert.show(); > > > > > > This code will produce a nice alert dialog with a perfect 9-patch > > > > > surrounding the ListView (options items) and a red bar at the top of > > > > > the ListView. > > > > > > **Problem** -- Still have a "border" around the LinearLayout. There is > > > > > a thin black horizontal bar at the top *and* a 1-pixel frame around > > > > > the whole thing. Its that "frame" around the dialog I want to get rid > > > > > of. > > > > > > Is that a remnant of the LinearLayout that wraps the ListView? Do I > > > > > need to specify some sort of "no border" attribute to the > > > > > LinearLayout? Or is it a remnant of the Dialog? Do I need to do > > > > > something beyond the requestWindowFeature (no title) statement? > > > > > > On Apr 2, 7:36 pm, Dianne Hackborn <hack...@android.com> wrote: > > > > > > The window will be resized to wrap its content. Be sure in your > > > 9-patch > > > > > > that you have correctly indicated the content area along the right > > > and > > > > > > bottom edges. If that isn't the problem, you can use > > > > > > hierarchyviewer > > > to > > > > > see > > > > > > what is going on with the layout of the view hierarchy if your > > > window. > > > > > You > > > > > > don't want to set a specific layout size. > > > > > > > On Sat, Apr 2, 2011 at 4:30 PM, Nick Longinow < > > > nicklongi...@gmail.com > > > > > >wrote: > > > > > > > > Getting much closer. But not quite. I've got my customized > > > background > > > > > > > (nine patch) built and assigned to the alert window. But, its huge > > > > > > > while the dialog list items are normal size. I did > > > > > > > alert.getWindow().setLayout(50, 50) to resize that window but it > > > has > > > > > > > no effect. Still have this huge background and small dialog > > > > > > > contents. Must be missing something big here. > > > > > > > > Here is my Dialog display code: > > > > > > > > mAlert = builder.create(); > > > > mAlert.requestWindowFeature(Window.FEATURE_NO_TITLE); > > > > > > > mAlert.getWindow().setLayout(50, 50); > > > > > > > // *** this is the nine patch > > > > > > > (looks > > > > > > > beautiful by the way, just huge) > > > > mAlert.getWindow().setBackgroundDrawable(getResources().getDrawable(R.drawable.eight)); > > > > > > > // *** > > > > > > > mAlert.show(); > > > > > > > > On Apr 2, 4:16 pm, Nick Longinow <nicklongi...@gmail.com> wrote: > > > > > > > > Successfully got a .9.png file created and applied it to my > > > ListView > > > > > - > > > > > > > > looks very nice. Problem - the AlertDialog I want to use it for > > > > > seems > > > > > > > > to add a rectangle with white interior as a container or border > > > > > around > > > > > > > > my ListView. I'd like it to be transparent, and only show the > > > > > > > > ListView. Do I have to do an "extends alertdialog" class to get > > > rid > > > > > of > > > > > > > > that white border? > > > > > > > > > On Mar 30, 6:21 pm, Nick Longinow <nicklongi...@gmail.com> > > > wrote: > > > > > > > > > > Then that's what I'll do. Moving the triangle around randomly > > > > > isn't > > > > > > > > > very important. Thanks all. > > > > > > > > > > On Mar 29, 10:29 pm, Dianne Hackborn <hack...@android.com> > > > wrote: > > > > > > > > > > > No, use a 9-patch. That said, if you want to actually > > > position > > > > > the > > > > > > > triangle > > > > > > > > > > at different places in the border you probably will need to > > > give > > > > > up > > > > > > > on just > > > > > > > > > > setting a custom background drawable and have to draw your > > > own > > > > > > > background > > > > > > > > > > with things positioned where you want. > > > > > > > > > > > On Tue, Mar 29, 2011 at 6:06 PM, Nick Longinow < > > > > > > > nicklongi...@gmail.com>wrote: > > > > > > > > > > > > I'm looking for something more like a <shape> where the > > > > > vertices > > > > > > > are > > > > > > > > > > > set to like a rectangle, but with one side that has a > > > triangle > > > > > > > shape > > > > > > > > > > > coming out of it. I believe I create this as a drawable > > > > > > > > > > > in > > > the > > > > > XML > > > > > > > > > > > layout, and then set the Dialog to use this drawable as > > > > > > > > > > > the > > > > > > > > > > > background. True so far? > > > > > > > > > > > > On Mar 27, 11:01 pm, Hari Edo <hari....@gmail.com> wrote: > > > > > > > > > > > > If you mean like the SMS app, you can do that with a > > > .9.png > > > > > > > > > > > > image file, also called a "Nine Patch." > > > >http://developer.android.com/guide/topics/graphics/2d-graphics.html#n. > > > > > .. > > > > > > > > > > > > > On Mar 27, 10:34 pm, Nick Longinow < > > > nicklongi...@gmail.com> > > > > > > > wrote: > > > > > > > > > > > > > > Like a balloon-style dialog, with one side of the > > > dialog > > > > > having > > > > > > > a > > > > > > > > > > > > > triangle coming out of it so that the dialog appears > > > > > > > > > > > > > to > > > > > point > > > > > > > to some > > > > > > > > > > > > > portion of the screen. I've seen these in alot of > > > > > > > > > > > > > apps > > > - > > > > > what > > > > > > > is the > > > > > > > > > > > > > basic idea here? Is it use of shapes and themes? Any > > > > > simple > > > > > > > examples > > > > > > > > > > > > > out there?- Hide quoted text - > > > > > > > > > > > > > - Show quoted text - > > > > > > > > > > > > -- > > > > > > > > > > > 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 > > > > > > > > > > > -- > > > > > > > > > > Dianne Hackborn > > > > > > > > > > Android framework engineer > > > > > > > > > > hack...@android.com > > > > > > > > > > > Note: please don't send private questions to me, as I don't > > > have > > > > > time > > > > > > > to > > > > > > > > > > provide private support, and so won't reply to such e-mails. > > > All > > > > > > > such > > > > > > > > > > questions should be posted on public forums, where I and > > > others > > > > > can > > > > > > > see and > > > > > > > > > > answer them.- Hide quoted text - > > > > > > > > > > > - Show quoted text -- Hide quoted text - > > > > > > > > > > - Show quoted text -- Hide quoted text - > > ... > > read more »- Hide quoted text - > > - Show quoted text - -- 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