zoukankan      html  css  js  c++  java
  • 天明闹钟开发过程5

    进行app的布局代码编写。

     1 <?xml version="1.0" encoding="utf-8"?>
     2 <AbsoluteLayout
     3     android:id="@+id/layout2"
     4     android:layout_width="fill_parent"
     5     android:layout_height="fill_parent"
     6     xmlns:android="http://schemas.android.com/apk/res/android"
     7     >
     8     <TextView
     9         android:id="@+id/text1"
    10         android:layout_width="wrap_content"
    11         android:layout_height="wrap_content"
    12         android:text="@string/str_text1"
    13         android:textColor="@drawable/white"
    14         android:textSize="16sp"
    15         android:layout_x="10px"
    16         android:layout_y="32px"
    17         >
    18     </TextView>
    19     <TextView
    20         android:id="@+id/text2"
    21         android:layout_width="wrap_content"
    22         android:layout_height="wrap_content"
    23         android:text="@string/str_text2"
    24         android:textColor="@drawable/white"
    25         android:textSize="16sp"
    26         android:layout_x="10px"
    27         android:layout_y="172px"
    28         >
    29     </TextView>
    30     <TimePicker
    31         android:id="@+id/tPicker"
    32         android:layout_width="wrap_content"
    33         android:layout_height="wrap_content"
    34         android:layout_x="100px"
    35         android:layout_y="12px"
    36         >
    37     </TimePicker>
    38     <EditText
    39         android:id="@+id/mEdit"
    40         android:layout_width="52px"
    41         android:layout_height="40px"
    42         android:text="15"
    43         android:textSize="16sp"
    44         android:layout_x="120px"
    45         android:layout_y="162px"
    46         >
    47     </EditText>
    48     <TextView
    49         android:id="@+id/text3"
    50         android:layout_width="wrap_content"
    51         android:layout_height="wrap_content"
    52         android:text="@string/str_text3"
    53         android:textColor="@drawable/white"
    54         android:textSize="16sp"
    55         android:layout_x="180px"
    56         android:layout_y="172px"
    57         >
    58     </TextView>
    59 </AbsoluteLayout>
      1 <?xml version="1.0" encoding="utf-8"?>
      2 <android.support.v4.widget.DrawerLayout
      3     xmlns:android="http://schemas.android.com/apk/res/android"
      4     xmlns:tools="http://schemas.android.com/tools"
      5     android:id="@+id/drawer_layout"
      6     android:layout_width="match_parent"
      7     android:layout_height="match_parent"
      8     android:background="@drawable/ic_launcher_background"
      9     tools:context="com.cn.daming.MainActivity">
     10 
     11     <TextView
     12         android:layout_width="match_parent"
     13         android:layout_height="match_parent"
     14         android:layout_gravity="start"
     15         android:text="版权所有:天明
    "
     16         android:textSize="30sp"
     17         android:background="#FFF"/>
     18 <AbsoluteLayout
     19     android:layout_width="match_parent"
     20     android:layout_height="match_parent"
     21     android:id="@+id/layout1">
     22     <android.support.v7.widget.Toolbar
     23         android:id="@+id/toolbar"
     24         android:layout_width="match_parent"
     25         android:layout_height="?attr/actionBarSize"
     26         android:background="?attr/colorPrimary"
     27         android:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar"
     28         android:popupTheme="@style/ThemeOverlay.AppCompat.Light"/>
     29 
     30     <DigitalClock
     31         android:id="@+id/dClock"
     32         android:layout_width="wrap_content"
     33         android:layout_height="wrap_content"
     34         android:layout_x="124dp"
     35         android:layout_y="50dp"
     36         android:textColor="@drawable/white"
     37         android:textSize="40sp"/>
     38 
     39     <TextView
     40         android:id="@+id/text1"
     41         android:layout_width="wrap_content"
     42         android:layout_height="wrap_content"
     43         android:layout_x="89dp"
     44         android:layout_y="118dp"
     45         android:text="@string/str_title3"
     46         android:textColor="@drawable/black"
     47         android:textSize="20sp"></TextView>
     48 
     49     <Button
     50         android:id="@+id/mButton1"
     51         android:layout_width="wrap_content"
     52         android:layout_height="160px"
     53         android:layout_x="200dp"
     54         android:layout_y="106dp"
     55         android:text="@string/str_button1"
     56         android:textColor="@drawable/black"
     57         android:textSize="18sp"></Button>
     58 
     59     <TextView
     60         android:id="@+id/setTime1"
     61         android:layout_width="wrap_content"
     62         android:layout_height="wrap_content"
     63         android:layout_x="75dp"
     64         android:layout_y="158dp"
     65         android:text="@string/str_default"
     66         android:textColor="@drawable/red"
     67         android:textSize="16sp"></TextView>
     68 
     69     <Button
     70         android:id="@+id/mButton2"
     71         android:layout_width="wrap_content"
     72         android:layout_height="160px"
     73         android:layout_x="200dp"
     74         android:layout_y="150dp"
     75         android:text="@string/str_button2"
     76         android:textColor="@drawable/black"
     77         android:textSize="18sp"></Button>
     78 
     79     <TextView
     80         android:id="@+id/text5"
     81         android:layout_width="wrap_content"
     82         android:layout_height="wrap_content"
     83         android:layout_x="92dp"
     84         android:layout_y="218dp"
     85         android:text="@string/str_title4"
     86         android:textColor="@drawable/black"
     87         android:textSize="20sp"></TextView>
     88 
     89     <Button
     90         android:id="@+id/mButton5"
     91         android:layout_width="wrap_content"
     92         android:layout_height="160px"
     93         android:layout_x="200dp"
     94         android:layout_y="194dp"
     95         android:text="@string/str_button1"
     96         android:textColor="@drawable/black"
     97         android:textSize="18sp"></Button>
     98 
     99     <TextView
    100         android:id="@+id/setTime5"
    101         android:layout_width="wrap_content"
    102         android:layout_height="wrap_content"
    103         android:layout_x="87dp"
    104         android:layout_y="243dp"
    105         android:text="@string/str_default"
    106         android:textColor="@drawable/red"
    107         android:textSize="16sp"></TextView>
    108 
    109     <Button
    110         android:id="@+id/mButton6"
    111         android:layout_width="wrap_content"
    112         android:layout_height="160px"
    113         android:layout_x="200dp"
    114         android:layout_y="238dp"
    115         android:text="@string/str_button2"
    116         android:textColor="@drawable/black"
    117         android:textSize="18sp"></Button>
    118 
    119     <TextView
    120         android:id="@+id/text2"
    121         android:layout_width="wrap_content"
    122         android:layout_height="wrap_content"
    123         android:layout_x="33dp"
    124         android:layout_y="316dp"
    125         android:text="@string/str_title2"
    126         android:textColor="@drawable/black"
    127         android:textSize="20sp"></TextView>
    128 
    129     <Button
    130         android:id="@+id/mButton3"
    131         android:layout_width="wrap_content"
    132         android:layout_height="160px"
    133         android:layout_x="200dp"
    134         android:layout_y="285dp"
    135         android:text="@string/str_button1"
    136         android:textColor="@drawable/black"
    137         android:textSize="18sp"></Button>
    138 
    139     <TextView
    140         android:id="@+id/setTime2"
    141         android:layout_width="300px"
    142         android:layout_height="wrap_content"
    143         android:layout_x="66dp"
    144         android:layout_y="360dp"
    145         android:text="@string/str_default"
    146         android:textColor="@drawable/red"
    147         android:textSize="16sp"></TextView>
    148 
    149     <Button
    150         android:id="@+id/mButton4"
    151         android:layout_width="wrap_content"
    152         android:layout_height="160px"
    153         android:layout_x="200dp"
    154         android:layout_y="329dp"
    155         android:text="@string/str_button2"
    156         android:textColor="@drawable/black"
    157         android:textSize="18sp"></Button>
    158 </AbsoluteLayout>
    159 </android.support.v4.widget.DrawerLayout>
    activity_main
     1 <resources>
     2     <string name="app_name">天明闹钟</string>
     3     <string name="hello">Hello World, EX06_10</string>
     4     <string name="str_button1">设置闹钟</string>
     5 
     6     <string name="str_button2">删除闹钟</string>
     7 
     8     <string name="str_title2">重复响起的闹钟</string>
     9 
    10     <string name="str_title3">闹钟一</string>
    11 
    12     <string name="str_title4">闹钟二</string>
    13 
    14     <string name="str_default">目前无设置</string>
    15 
    16     <string name="str_text1">开始时间</string>
    17 
    18     <string name="str_text2">重复响起的闹钟</string>
    19 
    20     <string name="str_text3"></string>
    21 </resources>
     1 resources>
     2 
     3     <!-- Base application theme. -->
     4     <style name="AppTheme" parent="Theme.AppCompat.Light.NoActionBar">
     5         <!-- Customize your theme here. -->
     6         <item name="colorPrimary">@color/colorPrimary</item>
     7         <item name="colorPrimaryDark">@color/colorPrimaryDark</item>
     8         <item name="colorAccent">@color/colorAccent</item>
     9     </style>
    10 
    11 </resources>
  • 相关阅读:
    【Salvation】——人物角色动画实现
    【Salvation】——项目进展&已取得的成果
    【Salvation】—— 项目策划&市场分析
    【前端阅读】——《程序员思维修炼》摘记&读后感&思维导图
    【性能优化】——前端性能优化之DOM
    【性能优化】——前端性能优化之图片
    【前端阅读】——《JavaScript入门经典》摘记之JavaScript与XML
    【前端阅读】——《JavaScript应用开发技术详解指南》摘记&思维导图
    【面试试题】——在浏览器输入网址,直到页面出现,之间发生了什么?
    【前端阅读】——《代码整洁之道》摘记之整洁代码、命名、函数、注释
  • 原文地址:https://www.cnblogs.com/watm/p/8504083.html
Copyright © 2011-2022 走看看