際際滷
Submit Search
Android Best Practices
Download as PPTX, PDF
0 likes
62 views
Mad Devs
Follow
Neobis 2017 Mob Dev meetup
Read less
Read more
1 of 15
Download now
Download to read offline
More Related Content
Android Best Practices
1.
Android Best Practices
2.
亟亠 仗仂亠
3.
- 弌舒舒亶亠 于亠亞亟舒
于于仂亟亳 仆亢仆亠 亠 于 仗亠亳舒仍仆亶 亟仍 仆亳 舒亰亟亠仍. - 仗亳仄亠 亠从舒 于 @string (R.string.) 亅仂 仗仂仄仂亢亠 亠亟舒从亳仂于舒仆亳亠仄 亠从舒 于 亟舒仍仆亠亶亠仄 亳 亟仂弍舒于仍亠仆亳亠仄 仄仍亳磶仆仂亳. - @attr 亟仍 从仂仆从亠仆 于亳亰仍仆 于仂亶于 亟仍 view . . .
4.
- 仗仂仍亰亶亠 SP
亳 DP 于仄亠仂 仗亳从亠仍亠亶. 仆舒亠 仗仂亠亟亠 于亠从舒 仆舒 舒亰仆 舒亰亠亠仆亳 亟亠于舒亶仂于. - 丱舒仆亳亠 于 Mipmaps 亳从仂仆从亳, 舒 于 Drawables 于亠 仂舒仍仆仂亠. 丐.从. 仆亟仂亳亟 亳仗仂仍亰亠 亳亰 drawables 仂仍从仂 仗舒仗从 仂仂于亠于ム亠亶 亠从亠仄 亳亠仄仆仂仄 舒亰亠亠仆亳 xxhdpi. - 仂仂仄 仂 亳亠仄舒 仄仂亢亠 亰舒亠弍仂于舒 亳从仂仆从亳 弍仂仍亠亠 于仂从仂亞仂 舒亰亠亠仆亳, 从 仗亳仄亠 仍舒仆亠 仗亳仍仂亢亠仆亳, 亳 从舒从 舒亰 mipmap 仄仂亢亠 于亟舒 舒 drawable 仆亠
5.
亰弍亠亞舒亶亠 仄仆仂亢亠于亠仆仆仂亞仂 仆舒仍亠亟仂于舒仆亳 于
xml <LinearLayout android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="vertical" > <RelativeLayout ... > <LinearLayout ... > <LinearLayout ... > <LinearLayout ... > </LinearLayout> </LinearLayout> </LinearLayout> </RelativeLayout> </LinearLayout>
6.
仗仂仍亰亶亠 仗仂亠 亳仄亠仆舒
亟仍 仗亠亠仄亠仆仆 亳 仗舒舒仄亠仂于. <resources> <!-- font sizes --> <dimen name="font_larger">22sp</dimen> <dimen name="font_large">18sp</dimen> <dimen name="font_normal">15sp</dimen> <dimen name="font_small">12sp</dimen> <!-- typical spacing between two views --> <dimen name="spacing_huge">40dp</dimen> <dimen name="spacing_large">24dp</dimen> <dimen name="spacing_normal">14dp</dimen> <dimen name="spacing_small">10dp</dimen> <dimen name="spacing_tiny">4dp</dimen> <!-- typical sizes of views --> <dimen name="button_height_tall">60dp</dimen> <dimen name="button_height_normal">40dp</dimen> <dimen name="button_height_short">32dp</dimen> </resources>
7.
亠 亠仆磺亠 仗仂于仂. Bad
<string name="network_error">Network error</string> <string name="call_failed">Call failed</string> <string name="map_failed">Map loading failed</string> Good <string name="error_message_network">Network error</string> <string name="error_message_call">Call failed</string> <string name="error_message_map">Map loading failed</string> 亠亠 仆亠 亰舒仗亳于舒亶亠 亠从仂于从 从舒仗仂仄. 舒仗 仄仂亢仆仂 仗仂仍亠 于舒于亳 仗舒舒仄亠仂仄 TextView textAllCaps=true
8.
舒亰于舒亶亠 于亠舒 于仂亳仄亳
亳仄亠仆舒仄亳 Bad <resources> <color name="button_foreground">#FFFFFF</color> <color name="button_background">#2A91BD</color> <color name="comment_background_inactive">#5F5F5F</color> <color name="comment_background_active">#939393</color> <color name="comment_foreground">#FFFFFF</color> <color name="comment_foreground_important">#FF9D2F</color> <color name="comment_shadow">#323232</color> Good <resources> <!-- grayscale --> <color name="white" >#FFFFFF</color> <color name="gray_light">#DBDBDB</color> <color name="gray" >#939393</color> <color name="gray_dark" >#5F5F5F</color> <color name="black" >#323232</color> <!-- basic colors --> <color name="green">#27D34D</color> <color name="blue">#2A91BD</color> <color name="orange">#FF9D2F</color> <color name="red">#FF432F</color> </resources>
9.
弌舒舒亶亠 亳仗仂仍亰仂于舒 styles styles.xml <style
name="ContentText"> <item name="android:textSize">@dimen/font_normal</item> <item name="android:textColor">@color/basic_black</item> </style> <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="@string/price" style="@style/ContentText" />
10.
亟亠 于亠亞亟舒 于
从亠 http://androidweekly.net/ http://digest.mbltdev.ru/ https://android.jlelse.eu/ 仄仂亢亠 从仂 仂 仂仍从仆仍 舒从仂亶 亢亠 仗仂弍仍亠仄仂亶 亳 亠亳仍 亠亠, 亳仍亳 于 亠亳仍亳 亳 从仂仄 仂 仄仂亢亠 弍 仗仂仍亠亰仆仄.
11.
Parcelable 于仄亠仂 Serialazable Parcelable
仂 亳仆仄亠仆 仆亟仂亳亟. 仂亞亟舒 Serialazable 仂 Java. 亠于亶 舒弍仂舒亠 弍亠亠. 仂亟仂弍仆亠亠
12.
仗仂仍亰亠仄 Context 仗舒于亳仍仆仂. 仍亳
于 亳仗仂仍亰亠亠 亠亞仂 于 Singleton 仂 仗亠亠亟舒于舒亶亠 ApplicationContext. 丐.从. 仗仂仍亰 context 舒从亳于亳亳 仂仆 仄仂亢亠 仗亳于亠亳 从 亠从舒仄 仗舒仄亳, 仗仂仂仄 仂 GarbageCollector. 仗亳仄亠 从仂亞亟舒 亳仆亳亳舒仍亳亰亳亠亠 弍亳弍仍亳仂亠从, 仂 仗亠亠亟舒于舒亶亠 ApplicationContext. 仂亢亠亠 亳仗仂仍亰仂于舒 Context 从亳于亳亳 从仂亞亟舒 仆舒亟仂 于磶舒 仂弍亠从 亢亳亰仆亠仆仆仄 亳从仍仂仄 舒从亳于亳亳. 舒亟舒仗亠舒 于 仄仂亢亠亠 仂弍舒舒 从 view.getContext. 丐舒从仂亠 仂弍仆仂 仆亢仆仂 从仂亞亟舒 亰舒亟舒亠亠 于亠舒
13.
个舒亞仄亠仆 亳仍亳 从亳于亳亳 丼舒亠
于亠亞仂 仂于亠ム 亳仗仂仍亰仂于舒 舒从亳于亳亳. 亳仗仂仍亰仂于舒 舒亞仄亠仆 仍亳 从仂亞亟舒 仆亠仂弍仂亟亳仄仂, 仆舒仗亳仄亠 从仂亞亟舒 仆舒亟仂 仗仂从舒亰舒 亟于舒 从舒仆舒 于 仂亟仆仂仄 仂从仆亠, 从舒从 仂 亟亠仍舒亠 ViewPager.
14.
仂亳 仍ミ頴湖煮亠 弍亳弍仍亳仂亠从亳 Fresco,
Glide - 从舒从 仂仆亳 舒弍仂舒ム 亳 亰舒亠仄 Retrofit, OkHttp com.github.ihsanbal:LoggingInterceptor - 亟亠仍亠仆亳亠 仍仂亞仂于 亠仗仂仆舒 retrofit Com.roughike:bottom-bar Com.wdullaer:materialdatetimepicker Crashlytics, Fabric
15.
弌仍从亳 https://blog.mindorks.com/how-to-learn-android- development-f33dd6dba40d 舒亰仂于亠 亳仆从亳亳 亟仍
仆仂于亳从舒. https://blog.mindorks.com/android-development-best- practices-83c94b027fd3 舒 于亟仂仆仂于亳于舒 仄亠仆.
Download