zoukankan      html  css  js  c++  java
  • 实验4 颜色、字符串资源的使用

    实验报告

    一、实验目的及要求(本实验所涉及并要求掌握的知识点)

    1.掌握Android中颜色和字符串资源的使用方法。

    2.理解Android中尺寸和布局资源的使用方法。

    二、实验环境(本实验所使用的硬件设备和相关软件)

    (1)PC机

    (2)操作系统:Windows XP

    (3)软件: Eclipse, JDK1.6,Android SDK,ADT

    三、实验内容及步骤

    一、修改字符串资源

    二、新建颜色资源color.xml

    三、使用资源颜色和字符串资源与尺寸、布局资源的使用

    <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
        xmlns:tools="http://schemas.android.com/tools"
        android:id="@+id/LinearLayout1"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:background="@drawable/ppp"
        android:orientation="vertical"
        android:paddingBottom="@dimen/activity_vertical_margin"
        android:paddingLeft="@dimen/activity_horizontal_margin"
        android:paddingRight="@dimen/activity_horizontal_margin"
        android:paddingTop="@dimen/activity_vertical_margin"
        tools:context=".MainActivity" >
    
        <TextView
            android:id="@+id/usernameTV"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_weight="1"
            android:text="TextView" />
    
        <TextView
            android:id="@+id/textView1"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="@string/hello_world"
            android:textColor="@color/puzzle_background" 
            android:textSize="35dp"
            android:layout_gravity="center"
            android:layout_weight="1"
            />
    
        <Button
            android:id="@+id/button1"
            android:layout_width="fill_parent"
            android:layout_height="wrap_content"
            android:layout_marginTop="34dp"
            
            android:text="@string/continue_label"
            android:textColor="@color/puzzle_foreground"
            
            android:layout_gravity="center"
            android:layout_marginBottom="24dp"
            android:textSize="25dp"
            android:layout_weight="1"
            />
    
        <Button
            android:id="@+id/button2"
            android:layout_width="fill_parent"
            android:layout_height="wrap_content"
            
            android:text="@string/new_game_label" 
            android:layout_marginBottom="24dp"
            android:textSize="25dp"
            android:layout_weight="1"
            />
    
        <Button
            android:id="@+id/about"
            android:layout_width="fill_parent"
            android:layout_height="wrap_content"
            
            android:text="@string/about_label" 
            android:layout_marginBottom="24dp"
            android:textSize="25dp"
            android:layout_weight="1"
            />
    
        <Button
            android:id="@+id/exit"
            android:layout_width="fill_parent"
            android:layout_height="wrap_content"
            
            android:text="@string/exit_label"
            android:layout_marginBottom="24dp" 
            android:textSize="25dp"
            android:layout_weight="1"
            />
    
    </LinearLayout>

    四、实验结果(本实验源程序清单及运行结果或实验结论、实验设计图)

    代码:如上第三点已展示

    运行结果:(截图)

     

    五、实验总结(对本实验结果进行分析,实验心得体会及改进意见)

    通过实验可以对string字符串的运用,也可以熟悉地运用color对界面颜色的设置,对整个布局有更深的认识。

  • 相关阅读:
    Lookup Method
    ReLocated Record in Grid
    Call Form By FormString
    Send Mail
    十大已亡或正在灭亡的电脑技术
    一个程序员的内心自白摘录
    数据库中null和''具体的区别
    gridview 横向显示
    Exchange2007获取OWA邮箱容量的代码
    owa实现清空邮箱的代码
  • 原文地址:https://www.cnblogs.com/lijiahui/p/5327466.html
Copyright © 2011-2022 走看看