Skip to content

Commit a7d825d

Browse files
romannurikAndroid Git Automerger
authored andcommitted
am c3998ce: Merge "Update widget design guidelines for padding and 8dp." into ics-mr0
* commit 'c3998ced746ee97bc5f10a9de1b2848f85c8711e': Update widget design guidelines for padding and 8dp.
2 parents 1a1be44 + c3998ce commit a7d825d

File tree

2 files changed

+9
-7
lines changed

2 files changed

+9
-7
lines changed

docs/html/guide/practices/ui_guidelines/widget_design.jd

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -250,13 +250,15 @@ android.widget.FrameLayout}. Just as your activity layouts must adapt to differe
250250
sizes, widget layouts must adapt to different Home screen grid cell sizes.</p>
251251

252252
<p>Below is an example layout that a music widget showing text information and two buttons can use.
253-
It builds upon the previous discussion of adding margins depending on OS version.</p>
253+
It builds upon the previous discussion of adding margins depending on OS version. Note that the
254+
most robust and resilient way to add margins to the widget is to wrap the widget frame and contents
255+
in a padded {@link android.widget.FrameLayout}.</p>
254256

255257
<pre>
256258
&lt;FrameLayout
257259
android:layout_width="match_parent"
258260
android:layout_height="match_parent"
259-
android:layout_margin="@dimen/widget_margin"&gt;
261+
android:padding="@dimen/widget_margin"&gt;
260262

261263
&lt;LinearLayout
262264
android:layout_width="match_parent"
@@ -295,16 +297,16 @@ use flexible layouts attributes like so:</p>
295297

296298

297299
<p>When a user adds the widget to their home screen, on an example Android 4.0 device where each
298-
grid cell is 80dp &times; 100dp in size and 16dp of margins are automatically applied on all sizes,
300+
grid cell is 80dp &times; 100dp in size and 8dp of margins are automatically applied on all sizes,
299301
the widget will be stretched, like so:</p>
300302

301303

302304
<img src="{@docRoot}images/widget_design/music_example_stretched.png"
303-
alt="Music widget sitting on an example 80dp x 100dp grid with 16dp of automatic margins
305+
alt="Music widget sitting on an example 80dp x 100dp grid with 8dp of automatic margins
304306
added by the system" id="music_example_stretched">
305307

306308
<p class="img-caption"><strong>Figure 7.</strong> Music widget sitting on an example 80dp x 100dp
307-
grid with 16dp of automatic margins added by the system.</p>
309+
grid with 8dp of automatic margins added by the system.</p>
308310

309311

310312
<h2 id="templates">Using the App Widget Templates Pack</h2>

docs/html/guide/topics/appwidgets/index.jd

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -346,7 +346,7 @@ following layout classes:</p>
346346
&lt;FrameLayout
347347
android:layout_width="match_parent"
348348
android:layout_height="match_parent"
349-
<strong>android:layout_margin="@dimen/widget_margin"&gt;</strong>
349+
<strong>android:padding="@dimen/widget_margin"&gt;</strong>
350350

351351
&lt;LinearLayout
352352
android:layout_width="match_parent"
@@ -363,7 +363,7 @@ following layout classes:</p>
363363
<li>Create two dimensions resources, one in <code>res/values/</code> to provide the pre-Android 4.0 custom margins, and one in <code>res/values-v14/</code> to provide no extra padding for Android 4.0 widgets:
364364

365365
<p><strong>res/values/dimens.xml</strong>:<br>
366-
<pre>&lt;dimen name="widget_margin"&gt;15dp&lt;/dimen&gt;</pre></p>
366+
<pre>&lt;dimen name="widget_margin"&gt;8dp&lt;/dimen&gt;</pre></p>
367367

368368
<p><strong>res/values-v14/dimens.xml</strong>:<br>
369369
<pre>&lt;dimen name="widget_margin"&gt;0dp&lt;/dimen&gt;</pre></p>

0 commit comments

Comments
 (0)