1 page.title= 2 parent.title= 3 parent.link=index.html 4 5 trainingnavtop=true 6 previous.title= 7 previous.link=screensizes.html 8 next.title= UI 9 next.link=adaptui.html 10 11 @jd:body 12 13 14 <!-- This is the training bar --> 15 <div id="tb-wrapper"> 16 <div id="tb"> 17 18 <h2></h2> 19 <ol> 20 <li><a href="#TaskUseDP"></a></li> 21 <li><a href="#TaskProvideAltBmp"></a></li> 22 </ol> 23 24 <h2></h2> 25 26 <ul> 27 <li><a href="{@docRoot}guide/practices/screens_support.html"></a></li> 28 <li><a href="{@docRoot}guide/practices/ui_guidelines/icon_design.html"></a></li> 29 </ul> 30 31 <h2></h2> 32 33 <div class="download-box"> 34 <a href="http://developer.android.com/shareables/training/NewsReader.zip" class="button"> </a> 35 <p class="filename">NewsReader.zip</p> 36 </div> 37 38 39 </div> 40 </div> 41 42 <p></p> 43 44 <h2 id="TaskUseDP"></h2> 45 46 <p> 1 <code>dp</code> <code>sp</code> <code>dp</code> 1 160 dpi <code>sp</code> </p> 47 48 <p>2 <code>px</code> <code>dp</code> :</p> 49 50 <pre> 51 <Button android:layout_width="wrap_content" 52 android:layout_height="wrap_content" 53 android:text="@string/clickme" 54 android:layout_marginTop="20dp" /> 55 </pre> 56 57 <p> <code>sp</code> :</p> 58 59 <pre> 60 <TextView android:layout_width="match_parent" 61 android:layout_height="wrap_content" 62 android:textSize="20sp" /> 63 </pre> 64 65 66 <h2 id="TaskProvideAltBmp"></h2> 67 68 <p>Android </p> 69 70 <p> :</p> 71 72 <p><ul> 73 <li><code>xhdpi</code>: 2.0 74 <li><code>hdpi</code>: 1.5 75 <li><code>mdpi</code>: 1.0 76 <li><code>ldpi</code>: 0.75 77 </ul></p> 78 79 <p>200×200 <code>xhdpi</code> 150×150 <code>hdpi</code> 100×100 <code>mdpi</code> 75×75<code>ldpi</code> </p> 80 81 <p> <code>res/</code> :</p> 82 83 <pre class="classic no-pretty-print"> 84 MyProject/ 85 res/ 86 drawable-xhdpi/ 87 awesomeimage.png 88 drawable-hdpi/ 89 awesomeimage.png 90 drawable-mdpi/ 91 awesomeimage.png 92 drawable-ldpi/ 93 awesomeimage.png 94 </pre> 95 96 <p><code>@drawable/awesomeimage</code> dpi </p> 97 98 <p> <a 99 href="{@docRoot}guide/practices/ui_guidelines/icon_design.html"></a></p> 100 101