美文网首页我爱编程
2017Google Study Jams系列之实践1C-实践和

2017Google Study Jams系列之实践1C-实践和

作者: 娄叔啊喂 | 来源:发表于2017-03-12 19:23 被阅读93次

@极简主义患者/社交控/伪技术宅/沉迷幻想不能自拔的文艺少年
不定期更新的文字平台:微博 简书

1.安装Android Sutdio

  • 安装Java Development Kit(JDK,JAVA开发工具包)

JDK可以让你的电脑读取并运行Java语言
论坛视频缺省了JDK的安装,简单以Windows系统过一下,小白可直接百度 "JDK安装及环境配置",按照百度经验里面的教程一步一步来即可

- 验证是否已安装JDK  
win+r->输入cmd->输入`java -version`  
如果显示了版本为8&8以上,就可以直接跳过去安装AS了,否则the next
- 下载JDK
到Oracle官网找到JDK 8 for Windowsx64下载即可
- 再次验证
安装完成后要按照第一步再验证看是否安装成功
  • 安装Android Studio(工作环境)
    大家可以按照视频里说的去官网下载安装,但是似乎AS中文社区自带代理,下载速度很快也基本不会遇到因为墙而发生的古怪问题,方法提供给大家:
    • 百度搜索"Android Studio中文社区"进入首页或点击Android Studio 中文社区(官网)
    • 下拉看到"选择其他平台",在表格里面点击 android-studio-bundle-145.3537739-windows.exe 包含 Android SDK (推荐) 进行下载

2.茶休挑战

  • If I want to show a picture on my phone, what XML element should I use? ImageView
  • android:layout_width,android:test,android:src are all examples of what? attribute
  • Write the sentence "I like practice sets the best". ILikePracticeSetsTheBest
  • RelativeLayout and LinearLayout are known as what? ViewGroup
  • I always need to __ and __ my tags. open close
  • What are the names of the two instructors? Katherine and Kunal
  • Which line has an XML error on it? 21
  • What is the width of the TextView? 350dp
  • Complete the code to position the button.
    android:layout_alignParentBottom="true" android:layout_centerHorizontal="true"
  • Assu,e you are using the XML to the left and you have a screen that is 600dp tall. What is the height of the "Chai Tea" TextView? 100dp
  • 最终为题:Who am I making this cup of coffee for?
    每道题答对后会得到一个线索,十个线索连起来是一句话,Who is the production lead look on the materials webpage 进入这个页面按提示发现答案为Kagure Kabue

3.Hello World!(Version 2.2.3)

安装完之后我们就一起来开始我们的第一个上手项目吧,第一是熟悉一些IDE的基本操作,第二是巩固我们第一节课学习的东西

  • 打开Android Studio,点击"Start a new Android Studio Project"按照视频讲解新建项目
  • 一张图快速了解AS界面


    快速了解

4.创建生日贺卡应用

  • 基本步骤
    • 使用和选择正确的布局和视图(LinearLayout || RelativeLayout)
    • 在屏幕上对这些试图进行模拟定位,确定视图的位置属性(layout_width/layout_height/layout_alignParentRiht/layout_alignParentBottom)
    • 为视图添加样式属性(字体/大小/颜色/图片样式/边距)
      • 字体:fontFamily
      • 大小:textSize
      • 颜色:textColor
      • 图片:layout_width&layout_height="match_parent" +scale="centerCrop"
      • 边距:layout_margin || padding
  • 自制生日卡片
    按照视频中的基本步骤进行即可制作一个简单的小卡片
    • 献上丑作:


      预览界面:Galaxy Nexus
    • 源码:
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout
    xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:id="@+id/activity_main"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    tools:context="com.example.android.happybirthday.MainActivity">
    <ImageView
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:src="@drawable/IMG_0655"
        android:scaleType="centerCrop" />

    <TextView
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="Happy birthday"
        android:paddingTop="48dp"
        android:paddingLeft="128dp"
        android:fontFamily="monospace"
        android:textSize="26sp"
        android:textColor="@android:color/background_dark"
        android:id="@+id/textView3" />

    <TextView
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="My Dear"
        android:paddingTop="84dp"
        android:paddingLeft="128dp"
        android:fontFamily="monospace"
        android:textSize="26sp"
        android:textColor="@android:color/background_dark"
        android:id="@+id/textView2" />

    <TextView
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="From:Loushu"
        android:paddingTop="432dp"
        android:paddingLeft="128dp"
        android:fontFamily="monospace"
        android:textSize="22sp"
        android:textColor="@android:color/background_dark"
        android:id="@+id/textView4" />

    <ImageView
        android:layout_width="40dp"
        android:layout_height="40dp"
        android:src="@drawable/ShouhuiXin"
        android:scaleType="centerCrop"
        android:id="@+id/imageView"
        android:layout_below="@+id/textView3"
        android:layout_toRightOf="@+id/textView2"
        android:layout_toEndOf="@+id/textView2" />
</RelativeLayout>

相关文章

网友评论

    本文标题:2017Google Study Jams系列之实践1C-实践和

    本文链接:https://www.haomeiwen.com/subject/gfjzgttx.html