android开发之移动端屏幕适配随谈

这篇文章只属于作者自己使用,因为在IT界所有的公司对移动端屏幕适配问题,都有一套属于自己的方案;作者在这里写这篇文章只是为了记录自己的生活,对!仅此而已!

在我司对移动端屏幕适配主要使用的是dimens.xml文件来完成屏幕适配,因此针对不同的手机分辨率,就会要创建不同装有dimens.xml文件的文件夹;在我司主要针对3种分辨率进行适配.

第一种是values-800x480:那么,在此文件夹下我会创建一份dimens.xml文件,值得注意的是,我司对移动端屏幕适配的默认分辨率就是800x480;因此在此文件当中,就不像其他values文件夹中的dimens.xml那样直接就是1dp...300dp...;而800x400的文件在我司规定的是1 / 1.25倍,因此为了以后的便捷,我将800*480的dimens.xml文件copy过来:

<resources>

    <dimen name="s_1dp">0.8dp</dimen>
    <dimen name="s_2dp">1.6dp</dimen>
    <dimen name="s_3dp">2.4dp</dimen>
    <dimen name="s_4dp">3.2dp</dimen>
    <dimen name="s_5dp">4dp</dimen>
    <dimen name="s_6dp">4.8dp</dimen>
    <dimen name="s_7dp">5.6dp</dimen>
    <dimen name="s_8dp">6.4dp</dimen>
    <dimen name="s_9dp">7.2dp</dimen>
    <dimen name="s_10dp">8dp</dimen>
    <dimen name="s_11dp">8.8dp</dimen>
    <dimen name="s_12dp">9.6dp</dimen>
    <dimen name="s_13dp">10.4dp</dimen>
    <dimen name="s_14dp">11.2dp</dimen>
    <dimen name="s_15dp">12dp</dimen>
    <dimen name="s_16dp">12.8dp</dimen>
    <dimen name="s_17dp">13.6dp</dimen>
    <dimen name="s_18dp">14.4dp</dimen>
    <dimen name="s_19dp">15.2dp</dimen>
    <dimen name="s_20dp">16dp</dimen>
    <dimen name="s_21dp">16.8dp</dimen>
    <dimen name="s_22dp">17.6dp</dimen>
    <dimen name="s_23dp">18.4dp</dimen>
    <dimen name="s_24dp">19.2dp</dimen>
    <dimen name="s_25dp">20dp</dimen>
    <dimen name="s_26dp">20.8dp</dimen>
    <dimen name="s_27dp">21.6dp</dimen>
    <dimen name="s_28dp">22.4dp</dimen>
    <dimen name="s_29dp">23.2dp</dimen>
    <dimen name="s_30dp">24dp</dimen>
    <dimen name="s_31dp">24.8dp</dimen>
    <dimen name="s_32dp">25.6dp</dimen>
    <dimen name="s_33dp">26.4dp</dimen>
    <dimen name="s_34dp">27.2dp</dimen>
    <dimen name="s_35dp">28dp</dimen>
    <dimen name="s_36dp">28.8dp</dimen>
    <dimen name="s_37dp">29.6dp</dimen>
    <dimen name="s_38dp">30.4dp</dimen>
    <dimen name="s_39dp">31.2dp</dimen>
    <dimen name="s_40dp">32dp</dimen>
    <dimen name="s_41dp">32.8dp</dimen>
    <dimen name="s_42dp">33.6dp</dimen>
    <dimen name="s_43dp">34.4dp</dimen>
    <dimen name="s_44dp">35.2dp</dimen>
    <dimen name="s_45dp">36dp</dimen>
    <dimen name="s_46dp">36.8dp</dimen>
    <dimen name="s_47dp">37.6dp</dimen>
    <dimen name="s_48dp">38.4dp</dimen>
    <dimen name="s_49dp">39.2dp</dimen>
    <dimen name="s_50dp">40dp</dimen>
    <dimen name="s_51dp">40.8dp</dimen>
    <dimen name="s_52dp">41.6dp</dimen>
    <dimen name="s_53dp">42.4dp</dimen>
    <dimen name="s_54dp">43.2dp</dimen>
    <dimen name="s_55dp">44dp</dimen>
    <dimen name="s_56dp">44.8dp</dimen>
    <dimen name="s_57dp">45.6dp</dimen>
    <dimen name="s_58dp">46.4dp</dimen>
    <dimen name="s_59dp">47.2dp</dimen>
    <dimen name="s_60dp">48dp</dimen>
    <dimen name="s_61dp">48.8dp</dimen>
    <dimen name="s_62dp">49.6dp</dimen>
    <dimen name="s_63dp">50.4dp</dimen>
    <dimen name="s_64dp">51.2dp</dimen>
    <dimen name="s_65dp">52dp</dimen>
    <dimen name="s_66dp">52.8dp</dimen>
    <dimen name="s_67dp">53.6dp</dimen>
    <dimen name="s_68dp">54.4dp</dimen>
    <dimen name="s_69dp">55.2dp</dimen>
    <dimen name="s_70dp">56dp</dimen>
    <dimen name="s_71dp">56.8dp</dimen>
    <dimen name="s_72dp">57.6dp</dimen>
    <dimen name="s_73dp">58.4dp</dimen>
    <dimen name="s_74dp">59.2dp</dimen>
    <dimen name="s_75dp">60dp</dimen>
    <dimen name="s_76dp">60.8dp</dimen>
    <dimen name="s_77dp">61.6dp</dimen>
    <dimen name="s_78dp">62.4dp</dimen>
    <dimen name="s_79dp">63.2dp</dimen>
    <dimen name="s_80dp">64dp</dimen>
    <dimen name="s_81dp">64.8dp</dimen>
    <dimen name="s_82dp">65.6dp</dimen>
    <dimen name="s_83dp">66.4dp</dimen>
    <dimen name="s_84dp">67.2dp</dimen>
    <dimen name="s_85dp">68dp</dimen>
    <dimen name="s_86dp">68.8dp</dimen>
    <dimen name="s_87dp">69.6dp</dimen>
    <dimen name="s_88dp">70.4dp</dimen>
    <dimen name="s_89dp">71.2dp</dimen>
    <dimen name="s_90dp">72dp</dimen>
    <dimen name="s_91dp">72.8dp</dimen>
    <dimen name="s_92dp">73.6dp</dimen>
    <dimen name="s_93dp">74.4dp</dimen>
    <dimen name="s_94dp">75.2dp</dimen>
    <dimen name="s_95dp">76dp</dimen>
    <dimen name="s_96dp">76.8dp</dimen>
    <dimen name="s_97dp">77.6dp</dimen>
    <dimen name="s_98dp">78.4dp</dimen>
    <dimen name="s_99dp">79.2dp</dimen>
    <dimen name="s_100dp">80dp</dimen>
    <dimen name="s_101dp">80.8dp</dimen>
    <dimen name="s_102dp">81.6dp</dimen>
    <dimen name="s_103dp">82.4dp</dimen>
    <dimen name="s_104dp">83.2dp</dimen>
    <dimen name="s_105dp">84dp</dimen>
    <dimen name="s_106dp">84.8dp</dimen>
    <dimen name="s_107dp">85.6dp</dimen>
    <dimen name="s_108dp">86.4dp</dimen>
    <dimen name="s_109dp">87.2dp</dimen>
    <dimen name="s_110dp">88dp</dimen>
    <dimen name="s_111dp">88.8dp</dimen>
    <dimen name="s_112dp">89.6dp</dimen>
    <dimen name="s_113dp">90.4dp</dimen>
    <dimen name="s_114dp">91.2dp</dimen>
    <dimen name="s_115dp">92dp</dimen>
    <dimen name="s_116dp">92.8dp</dimen>
    <dimen name="s_117dp">93.6dp</dimen>
    <dimen name="s_118dp">94.4dp</dimen>
    <dimen name="s_119dp">95.2dp</dimen>
    <dimen name="s_120dp">96dp</dimen>
    <dimen name="s_121dp">96.8dp</dimen>
    <dimen name="s_122dp">97.6dp</dimen>
    <dimen name="s_123dp">98.4dp</dimen>
    <dimen name="s_124dp">99.2dp</dimen>
    <dimen name="s_125dp">100dp</dimen>
    <dimen name="s_126dp">100.8dp</dimen>
    <dimen name="s_127dp">101.6dp</dimen>
    <dimen name="s_128dp">102.4dp</dimen>
    <dimen name="s_129dp">103.2dp</dimen>
    <dimen name="s_130dp">104dp</dimen>
    <dimen name="s_131dp">104.8dp</dimen>
    <dimen name="s_132dp">105.6dp</dimen>
    <dimen name="s_133dp">106.4dp</dimen>
    <dimen name="s_134dp">107.2dp</dimen>
    <dimen name="s_135dp">108dp</dimen>
    <dimen name="s_136dp">108.8dp</dimen>
    <dimen name="s_137dp">109.6dp</dimen>
    <dimen name="s_138dp">110.4dp</dimen>
    <dimen name="s_139dp">111.2dp</dimen>
    <dimen name="s_140dp">112dp</dimen>
    <dimen name="s_141dp">112.8dp</dimen>
    <dimen name="s_142dp">113.6dp</dimen>
    <dimen name="s_143dp">114.4dp</dimen>
    <dimen name="s_144dp">115.2dp</dimen>
    <dimen name="s_145dp">116dp</dimen>
    <dimen name="s_146dp">116.8dp</dimen>
    <dimen name="s_147dp">117.6dp</dimen>
    <dimen name="s_148dp">118.4dp</dimen>
    <dimen name="s_149dp">119.2dp</dimen>
    <dimen name="s_150dp">120dp</dimen>
    <dimen name="s_151dp">120.8dp</dimen>
    <dimen name="s_152dp">121.6dp</dimen>
    <dimen name="s_153dp">122.4dp</dimen>
    <dimen name="s_154dp">123.2dp</dimen>
    <dimen name="s_155dp">124dp</dimen>
    <dimen name="s_156dp">124.8dp</dimen>
    <dimen name="s_157dp">125.6dp</dimen>
    <dimen name="s_158dp">126.4dp</dimen>
    <dimen name="s_159dp">127.2dp</dimen>
    <dimen name="s_160dp">128dp</dimen>
    <dimen name="s_161dp">128.8dp</dimen>
    <dimen name="s_162dp">129.6dp</dimen>
    <dimen name="s_163dp">130.4dp</dimen>
    <dimen name="s_164dp">131.2dp</dimen>
    <dimen name="s_165dp">132dp</dimen>
    <dimen name="s_166dp">132.8dp</dimen>
    <dimen name="s_167dp">133.6dp</dimen>
    <dimen name="s_168dp">134.4dp</dimen>
    <dimen name="s_169dp">135.2dp</dimen>
    <dimen name="s_170dp">136dp</dimen>
    <dimen name="s_171dp">136.8dp</dimen>
    <dimen name="s_172dp">137.6dp</dimen>
    <dimen name="s_173dp">138.4dp</dimen>
    <dimen name="s_174dp">139.2dp</dimen>
    <dimen name="s_175dp">140dp</dimen>
    <dimen name="s_176dp">140.8dp</dimen>
    <dimen name="s_177dp">141.6dp</dimen>
    <dimen name="s_178dp">142.4dp</dimen>
    <dimen name="s_179dp">143.2dp</dimen>
    <dimen name="s_180dp">144dp</dimen>
    <dimen name="s_181dp">144.8dp</dimen>
    <dimen name="s_182dp">145.6dp</dimen>
    <dimen name="s_183dp">146.4dp</dimen>
    <dimen name="s_184dp">147.2dp</dimen>
    <dimen name="s_185dp">148dp</dimen>
    <dimen name="s_186dp">148.8dp</dimen>
    <dimen name="s_187dp">149.6dp</dimen>
    <dimen name="s_188dp">150.4dp</dimen>
    <dimen name="s_189dp">151.2dp</dimen>
    <dimen name="s_190dp">152dp</dimen>
    <dimen name="s_191dp">152.8dp</dimen>
    <dimen name="s_192dp">153.6dp</dimen>
    <dimen name="s_193dp">154.4dp</dimen>
    <dimen name="s_194dp">155.2dp</dimen>
    <dimen name="s_195dp">156dp</dimen>
    <dimen name="s_196dp">156.8dp</dimen>
    <dimen name="s_197dp">157.6dp</dimen>
    <dimen name="s_198dp">158.4dp</dimen>
    <dimen name="s_199dp">159.2dp</dimen>
    <dimen name="s_200dp">160dp</dimen>
    
    <dimen name="s_201dp">160.8dp</dimen>
    <dimen name="s_202dp">161.6dp</dimen>
    <dimen name="s_203dp">162.4dp</dimen>
    <dimen name="s_204dp">163.2dp</dimen>
    <dimen name="s_205dp">164dp</dimen>
    <dimen name="s_206dp">164.8dp</dimen>
    <dimen name="s_207dp">165.6dp</dimen>
    <dimen name="s_208dp">166.4dp</dimen>
    <dimen name="s_209dp">167.2dp</dimen>
    <dimen name="s_210dp">168dp</dimen>
    <dimen name="s_211dp">168.8dp</dimen>
    <dimen name="s_212dp">169.6dp</dimen>
    <dimen name="s_213dp">170.4dp</dimen>
    <dimen name="s_214dp">171.2dp</dimen>
    <dimen name="s_215dp">172dp</dimen>
    <dimen name="s_216dp">172.8dp</dimen>
    <dimen name="s_217dp">173.6dp</dimen>
    <dimen name="s_218dp">174.4dp</dimen>
    <dimen name="s_219dp">175.2dp</dimen>
    <dimen name="s_220dp">176dp</dimen>
    <dimen name="s_221dp">176.8dp</dimen>
    <dimen name="s_222dp">177.6dp</dimen>
    <dimen name="s_223dp">178.4dp</dimen>
    <dimen name="s_224dp">179.2dp</dimen>
    <dimen name="s_225dp">180dp</dimen>
    <dimen name="s_226dp">180.8dp</dimen>
    <dimen name="s_227dp">181.6dp</dimen>
    <dimen name="s_228dp">182.4dp</dimen>
    <dimen name="s_229dp">183.2dp</dimen>
    <dimen name="s_230dp">184dp</dimen>
    <dimen name="s_231dp">184.8dp</dimen>
    <dimen name="s_232dp">185.6dp</dimen>
    <dimen name="s_233dp">186.4dp</dimen>
    <dimen name="s_234dp">187.2dp</dimen>
    <dimen name="s_235dp">188dp</dimen>
    <dimen name="s_236dp">188.8dp</dimen>
    <dimen name="s_237dp">189.6dp</dimen>
    <dimen name="s_238dp">190.4dp</dimen>
    <dimen name="s_239dp">191.2dp</dimen>
    <dimen name="s_240dp">192dp</dimen>
    <dimen name="s_241dp">192.8dp</dimen>
    <dimen name="s_242dp">193.6dp</dimen>
    <dimen name="s_243dp">194.4dp</dimen>
    <dimen name="s_244dp">195.2dp</dimen>
    <dimen name="s_245dp">196dp</dimen>
    <dimen name="s_246dp">196.8dp</dimen>
    <dimen name="s_247dp">197.6dp</dimen>
    <dimen name="s_248dp">198.4dp</dimen>
    <dimen name="s_249dp">199.2dp</dimen>
    <dimen name="s_250dp">200dp</dimen>
    <dimen name="s_251dp">200.8dp</dimen>
    <dimen name="s_252dp">201.6dp</dimen>
    <dimen name="s_253dp">202.4dp</dimen>
    <dimen name="s_254dp">203.2dp</dimen>
    <dimen name="s_255dp">204dp</dimen>
    <dimen name="s_256dp">204.8dp</dimen>
    <dimen name="s_257dp">205.6dp</dimen>
    <dimen name="s_258dp">206.4dp</dimen>
    <dimen name="s_259dp">207.2dp</dimen>
    <dimen name="s_260dp">208dp</dimen>
    <dimen name="s_261dp">208.8dp</dimen>
    <dimen name="s_262dp">209.6dp</dimen>
    <dimen name="s_263dp">210.4dp</dimen>
    <dimen name="s_264dp">211.2dp</dimen>
    <dimen name="s_265dp">212dp</dimen>
    <dimen name="s_266dp">212.8dp</dimen>
    <dimen name="s_267dp">213.6dp</dimen>
    <dimen name="s_268dp">214.4dp</dimen>
    <dimen name="s_269dp">215.2dp</dimen>
    <dimen name="s_270dp">216dp</dimen>
    <dimen name="s_271dp">216.8dp</dimen>
    <dimen name="s_272dp">217.6dp</dimen>
    <dimen name="s_273dp">218.4dp</dimen>
    <dimen name="s_274dp">219.2dp</dimen>
    <dimen name="s_275dp">220dp</dimen>
    <dimen name="s_276dp">220.8dp</dimen>
    <dimen name="s_277dp">221.6dp</dimen>
    <dimen name="s_278dp">222.4dp</dimen>
    <dimen name="s_279dp">223.2dp</dimen>
    <dimen name="s_280dp">224dp</dimen>
    <dimen name="s_281dp">224.8dp</dimen>
    <dimen name="s_282dp">225.6dp</dimen>
    <dimen name="s_283dp">226.4dp</dimen>
    <dimen name="s_284dp">227.2dp</dimen>
    <dimen name="s_285dp">228dp</dimen>
    <dimen name="s_286dp">228.8dp</dimen>
    <dimen name="s_287dp">229.6dp</dimen>
    <dimen name="s_288dp">230.4dp</dimen>
    <dimen name="s_289dp">231.2dp</dimen>
    <dimen name="s_290dp">232dp</dimen>
    <dimen name="s_291dp">232.8dp</dimen>
    <dimen name="s_292dp">233.6dp</dimen>
    <dimen name="s_293dp">234.4dp</dimen>
    <dimen name="s_294dp">235.2dp</dimen>
    <dimen name="s_295dp">236dp</dimen>
    <dimen name="s_296dp">236.8dp</dimen>
    <dimen name="s_297dp">237.6dp</dimen>
    <dimen name="s_298dp">238.4dp</dimen>
    <dimen name="s_299dp">239.2dp</dimen>
    <dimen name="s_300dp">240dp</dimen>

    <dimen name="s_301dp">240.8dp</dimen>
    <dimen name="s_302dp">241.6dp</dimen>
    <dimen name="s_303dp">242.4dp</dimen>
    <dimen name="s_304dp">243.2dp</dimen>
    <dimen name="s_305dp">244dp</dimen>
    <dimen name="s_306dp">244.8dp</dimen>
    <dimen name="s_307dp">245.6dp</dimen>
    <dimen name="s_308dp">246.4dp</dimen>
    <dimen name="s_309dp">247.2dp</dimen>
    <dimen name="s_310dp">248dp</dimen>
    <dimen name="s_311dp">248.8dp</dimen>
    <dimen name="s_312dp">249.6dp</dimen>
    <dimen name="s_313dp">250.4dp</dimen>
    <dimen name="s_314dp">251.2dp</dimen>
    <dimen name="s_315dp">252dp</dimen>
    <dimen name="s_316dp">252.8dp</dimen>
    <dimen name="s_317dp">253.6dp</dimen>
    <dimen name="s_318dp">254.4dp</dimen>
    <dimen name="s_319dp">255.2dp</dimen>
    <dimen name="s_320dp">256dp</dimen>
    <dimen name="s_321dp">256.8dp</dimen>
    <dimen name="s_322dp">257.6dp</dimen>
    <dimen name="s_323dp">258.4dp</dimen>
    <dimen name="s_324dp">259.2dp</dimen>
    <dimen name="s_325dp">260dp</dimen>
    <dimen name="s_326dp">260.8dp</dimen>
    <dimen name="s_327dp">261.6dp</dimen>
    <dimen name="s_328dp">262.4dp</dimen>
    <dimen name="s_329dp">263.2dp</dimen>
    <dimen name="s_330dp">264dp</dimen>
    <dimen name="s_331dp">264.8dp</dimen>
    <dimen name="s_332dp">265.6dp</dimen>
    <dimen name="s_333dp">266.4dp</dimen>
    <dimen name="s_334dp">267.2dp</dimen>
    <dimen name="s_335dp">268dp</dimen>
    <dimen name="s_336dp">268.8dp</dimen>
    <dimen name="s_337dp">269.6dp</dimen>
    <dimen name="s_338dp">270.4dp</dimen>
    <dimen name="s_339dp">271.2dp</dimen>
    <dimen name="s_340dp">272dp</dimen>
    <dimen name="s_341dp">272.8dp</dimen>
    <dimen name="s_342dp">273.6dp</dimen>
    <dimen name="s_343dp">274.4dp</dimen>
    <dimen name="s_344dp">275.2dp</dimen>
    <dimen name="s_345dp">276dp</dimen>
    <dimen name="s_346dp">276.8dp</dimen>
    <dimen name="s_347dp">277.6dp</dimen>
    <dimen name="s_348dp">278.4dp</dimen>
    <dimen name="s_349dp">279.2dp</dimen>
    <dimen name="s_350dp">280dp</dimen>
    <dimen name="s_351dp">280.8dp</dimen>
    <dimen name="s_352dp">281.6dp</dimen>
    <dimen name="s_353dp">282.4dp</dimen>
    <dimen name="s_354dp">283.2dp</dimen>
    <dimen name="s_355dp">284dp</dimen>
    <dimen name="s_356dp">284.8dp</dimen>
    <dimen name="s_357dp">285.6dp</dimen>
    <dimen name="s_358dp">286.4dp</dimen>
    <dimen name="s_359dp">287.2dp</dimen>

</resources>
第二种是values-1280x720,使用的dp都是1:1

第三种是values-1920x1080,使用的dp同样的是1:1

作者请注意,公司现在规定设计图上给的文字都使用dp,而不是sp,同时设计图上标记的适配大小通通1dp/2,文本是1dp/2+1.


你可能感兴趣的:(Android开发,屏幕适配)