Home | History | Annotate | Download | only in multiscreen
      1 page.title=Supporting Different Densities
      2 parent.title=Designing for Multiple Screens
      3 parent.link=index.html
      4 
      5 trainingnavtop=true
      6 previous.title=Supporting Different Screen Sizes
      7 previous.link=screensizes.html
      8 next.title=Implementing Adaptative UI Flows
      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>          &nbsp;          .      ,  -            .      <code>dp</code>  <code>sp</code>. <code>dp</code>&nbsp;      ,        160&nbsp;/. <code>sp</code>    ,        ,        ,    .</p>
     47 
     48 <p>,       ,   <code>dp</code>,   <code>px</code>:</p>
     49 
     50 <pre>
     51 &lt;Button android:layout_width="wrap_content"
     52     android:layout_height="wrap_content"
     53     android:text="&#64;string/clickme"
     54     android:layout_marginTop="20dp" /&gt;
     55 </pre>
     56 
     57 <p>      <code>sp</code>:</p>
     58 
     59 <pre>
     60 &lt;TextView android:layout_width="match_parent"
     61     android:layout_height="wrap_content"
     62     android:textSize="20sp" /&gt;
     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> ,  ,       <code>xhdpi</code>   200&nbsp;x&nbsp;200,   <code>hdpi</code>    150&nbsp;x&nbsp;150,   <code>mdpi</code>&nbsp; 100&nbsp;x&nbsp;100,    <code>ldpi</code>&nbsp; 75&nbsp;x&nbsp;75.</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>&#64;drawable/awesomeimage</code>    ,   .</p>
     97 
     98 <p>        <a
     99 href="{@docRoot}guide/practices/ui_guidelines/icon_design.html">   </a>.</p>
    100 
    101