android big nerd 3,Android Programming The Big Nerd Ranch Guide 第1-5章

第一章

1、Activity:Android中负责与屏幕、用户等进行交互。可以通过继承Activity,并在其子类中实现程序的逻辑功能。格式例如QuizActivity。

2、layout文件存放在res/layout下,格式例如activity_quiz.xml。

3、layout一般由布局(Layout)、组件(Widgets)等组成。

常见布局:RelativeLayout、LinearLayout(竖排列的vertical、横排列的horizontal)。

常见组件:TextView、Button。

4、一个基本的layout文件:

android:layout_width="match_parent"

android:layout_height="match_parent"

android:gravity="center"

android:orientation="vertical" >

android:id="@+id/question_text_view"

android:layout_width="wrap_content"

android:layout_height="wrap_content"

android:padding="24dp" />

android:layout_width="wrap_content"

android:layout_height="wrap_content"

android:orientation="horizontal">

android:id="@+id/true_button"

android:layout_width="wrap_content"

android:layout_height="wrap_content"

android:text="@string/true_button" />

android:id="@+id/false_button"

android:layout_width="wrap_content"

android:layout_height="wrap_content"

android:text="@string/false_button" />

上面出现了几个属性:

android:id:为widget指定一个新id,格式为+id/xxx。

android:text:组件上要显示的文本,可以是直接输入,或者引用string.xml中的。格式为@string/xxxx。

android:layout_width:组件宽度,一般为wrap_content、match_parent。

android:layout_height:组件高度,同上。

android:gravity:组件内的内容的分布位置,例如center,可另Button内的文本居中显示。

android:orientation:对于LinearLayout,决定了其下的自widget/layout,是为横排还是竖排。

5、

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
Title: Android Programming: The Big Nerd Ranch Guide, 3rd Edition Author: Bill Phillips, Chris Stewart Length: 624 pages Edition: 3 Language: English Publisher: Big Nerd Ranch Guides Publication Date: 2017-02-09 ISBN-10: 0134706056 ISBN-13: 9780134706054 Table of Contents Chapter 1. Your First Android Application Chapter 2. Android and Model-View-Controller Chapter 3. The Activity Lifecycle Chapter 4. Debugging Android Apps Chapter 5. Your Second Activity Chapter 6. Android SDK Versions and Compatibility Chapter 7. UI Fragments and the Fragment Manager Chapter 8. Displaying Lists with RecyclerView Chapter 9. Creating User Interfaces with Layouts and Widgets Chapter 10. Using Fragment Arguments Chapter 11. Using ViewPager Chapter 12. Dialogs Chapter 13. The Toolbar Chapter 14. SQLite Databases Chapter 15. Implicit Intents Chapter 16. Taking Pictures with Intents Chapter 17. Two-Pane Master-Detail Interfaces Chapter 18. Localization Chapter 19. Accessibility Chapter 20. Data Binding and MVVM Chapter 21. Unit Testing and Audio Playback Chapter 22. Styles and Themes Chapter 23. XML Drawables Chapter 24. More About Intents and Tasks Chapter 25. HTTP and Background Tasks Chapter 26. Loopers, Handlers, and HandlerThread Chapter 27. Search Chapter 28. Background Services Chapter 29. Broadcast Intents Chapter 30. Browsing the Web and WebView Chapter 31. Custom Views and Touch Events Chapter 32. Property Animation Chapter 33. Locations and Play Services Chapter 34. Maps Chapter 35. Material Design Chapter 36. Afterword
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值