您的位置:首页 > 移动开发

studyjams notes PS1 设计一个静态的app

2016-04-18 21:51 344 查看

目标

学习设计一个view

学习合理放置view

学习设置view style

核心代码

<RelativeLayout xmlns:android="http://schemas.android.c3om/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".MainActivity">

<ImageView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:scaleType="centerCrop"
android:src="@drawable/androidparty" />

<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:fontFamily="sans-serif-light"
android:padding="20dp"
android:text="Happy Birthday, Ben!"
android:textColor="@android:color/white"
android:textSize="36sp" />

<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_alignParentRight="true"
android:fontFamily="sans-serif-light"
android:padding="20dp"
android:text="From, Lyla!"
android:textColor="@android:color/white"
android:textSize="36sp" />

</RelativeLayout>


QA

Coffee Break Challenge - 1 - Coffee Break Challenge Question 1

Q: 如果我想在手机上显示一个图片,我该使用什么控件?

A: ImageView

Coffee Break Challenge - 2 - Coffee Break Challenge Question 2

Q: android:layout_weight / android:text / android:src 描述了什么

A: layout

Coffee Break Challenge - 3 - Coffee Break Challenge Question 3

Q: 用驼峰法重写 “I like practice sets the best”

A: ILikePracticeSetsTheBest

Coffee Break Challenge - 4 - Coffee Break Challenge Question 4

Q: 相对布局(RelativeLayout)和线性布局(LinearLayout)是什么?

A: 相对布局能让控件在相对参考系里布局,方向比线性自由,

而线性布局专注横向或者纵向布局控件。

Coffee Break Challenge - 5 - Coffee Break Challenge Question 5

Q: I always need to X and X my tags 我总是需要对我的标签做哪两件事情?

A: start and close it

Coffee Break Challenge - 6 - Coffee Break Challenge Question 6

Q: 两个导师的名字是什么?

A: Katherine 和 Kunal

Coffee Break Challenge - 7 - Coffee Break Challenge Question 7

Q: 代码挑错…

A: 21行,android:layout_weight=1,应该加引号为 android:layout_weight=“1”

Coffee Break Challenge - 8 - Coffee Break Challenge Question 8

Q: 这个 TextView 的宽度是?

A: TextView 的宽度是 350dp

Coffee Break Challenge - 9 - Coffee Break Challenge Question 9

Q: 让那个 Button 正确的显示在屏幕的下方

A:

android:layout_centerHorizontal=”true”

android:layout_alignParentBottom=”true”

Coffee Break Challenge - 10 - Coffee Break Challenge Question 10

Q: 使用给定的 XML 代码并且假定屏幕有 600dp 高,那么 Chai tea TextView 的高度是多少?

A: (600-200) *1 /4 , 高度是 100dp。

Coffee Break Challenge - 11 - Coffee Break Challenge Final Question

Q: 在为谁做这个咖啡?

A: Lyla Fujiwara

她的github在此:https://github.com/ceruleanotter

学习笔记截图





结尾

android 团队学习且行且珍惜
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: