That's a good idea, I'll try that. By the way, if I want to replace one of the buttons from my widget provider per remoteviews, can I do this (for instance with removeAllViews and addView)? I've tried this and the widget than fails loading. Or do I need to set up a layout each for all possible combinations and then use this with updateAppWidget? ----- Original Message ----- From: Kostya Vasilyev To: [email protected] Sent: Friday, November 26, 2010 3:07 PM Subject: Re: [android-developers] Re: custom view in widget
Yes, portrait mode seems to be somewhat different. I don't have a tablet, but had to fix this for a Motorola Milestone (when the keyboard is pulled out, the home screen rotates). I did this by doing three things: - having separate layouts for portrait and landscape modes (you can use "res/layout_port", etc. in a widget); - specifying a larger width for the landscape layout (found empirically, so that my 2*1, 3*1, and 1*1 widgets line up at the edges when placed one below another); - using nine-patches for the backgrounds. One more trick would be to make use of layout_weight, although I haven't needed that. -- Kostya Vasilyev -- http://kmansoft.wordpress.com 27.11.2010 1:38 пользователь "Hendrik Greving" <[email protected]> написал: > So basically the ideal image size for a standard 1-row widget would be 320x100 * 1.5? I did both the minimum APIlevel (7) and enabled scaling (true). The problem I have is that they don't scale in an (emulated-) tablet. The OS seems to scale the width more than the height. I played around with all setting I could imagine, scale type, minimum width, height, wrap_content/fill_parent, 9-patch png's. What would be the standard way to make this work? I saw widget's that apparently can do this. > > ----- Original Message ----- > From: Kostya Vasilyev > To: [email protected] > Sent: Friday, November 26, 2010 2:08 PM > Subject: Re: [android-developers] Re: custom view in widget > > > When you read about standard widget sizes, that's in "dp" units: device independent pixels. On a high-res screen, your layouts are scaled by Android to a larger pixel size (a factor of 1.5 for hdpi). > > As for your issue with scaling - did you add support for scaling in the manifest? You can do it by either by setting minSdk to 4 and above, or by including a <supports-screens> element. > > -- > Kostya Vasilyev -- http://kmansoft.wordpress.com > > 27.11.2010 0:45 пользователь "Hendrik Greving" <[email protected]> написал: > > I'm much further now, thanks. I have 5 button in a horizontal linear layout. > > Each button is currently 167x280. I read that a one row widget is normally > > 320x100. However, if I scale each button to 64x100, it looks bad, probably > > because I need the density?! On a high density screen like a Nexus one,the > > 167x280 look perfect. The other problem I have is, that it scales badly. I > > would like to at least make it look 'ok' when used on a tablet. However, it > > looks like that it scales only the width, and doesn't preserve the ratio. > > I've tried a lot with different scale types, I've also tried 9-patch png > > images. If I do the latter, the button is scaled wrong in either case. Any > > idea? Thanks!! > > > > ----- Original Message ----- > > From: "Mark Murphy" <[email protected]> > > To: <[email protected]> > > Sent: Saturday, November 20, 2010 4:16 AM > > Subject: Re: [android-developers] Re: custom view in widget > > > > > >> On Fri, Nov 19, 2010 at 6:19 PM, Hendrik Greving <[email protected]> > >> wrote: > >>> So basically the widget can only use stuff from the OS? > >> > >> Please read the documentation: > >> > >> http://developer.android.com/guide/topics/appwidgets/index.html > >> > >> particularly: > >> > >> http://developer.android.com/guide/topics/appwidgets/index.html#CreatingLayout > >> > >> where it lists the eligible classes for use through a RemoteViews. > >> > >>> Let's say you want > >>> to draw something nice into a widget, I saw several widgets doing that, > >>> like > >>> HTML content or so, or a picture from your mum (j/k), how would you do > >>> that? > >> > >> Since you neglected to point out any examples, and since it is > >> impossible to tell by looking at a set of pixels whether or not they > >> came from "HTML content or so", it is difficult to answer your > >> question. > >> > >> TextView supports SpannedString, such as that returned by > >> Html.fromHtml(). RemoteViews supports sending a SpannedString to an > >> app widget. Hence, you can use that subset of HTML supported by > >> fromHtml() in a TextView hosted by an app widget. > >> > >> Also, please bear in mind that home screens are not subject to app > >> widget limitations. So, just because you might see an HTC Sense or > >> MOTOBLUR home screen doing something fancy does not mean that an app > >> widget is capable of the same feats of derring-do. > >> > >> -- > >> Mark Murphy (a Commons Guy) > >> http://commonsware.com | http://github.com/commonsguy > >> http://commonsware.com/blog | http://twitter.com/commonsguy > >> > >> _The Busy Coder's Guide to Android Development_ Version 3.2 Available! > >> > >> -- > >> 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 > > > -- > 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 -- 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

