android学习之TextView

    从昨天安装android开发环境后,今天开始了我的android学习之路。

我的第一课:新建一个android application project


file->new->projiet->android application project->Next->输入工程名等->Next->一直Next直到finish.


在res->layout中,修改main.xml文件如下:


<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" 
    xmlns:tools="http://schemas.android.com/tools" 
    android:orientation="vertical"                                                    //所有的组件垂直摆放
    android:layout_width="fill_parent"                                            //布局管理器宽度为屏幕宽度
    android:layout_height="fill_parent" >                                       //布局管理器高度为屏幕高度

    <TextView                                                                               //定义文本框显示组件

        android:layout_width="fill_parent"                                      //宽度为整个容器的宽度
        android:layout_height="wrap_content"                              //高度为文字高度
        android:text="@string/hello"                                              //显示的内容
    />

   <TextView
         android:id="@+id/mytext1"                                             //组件ID
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:text="@string/names"
        android:textSize="20px"                                                 //文字大小
        android:textColor="#fff000"                                            //文字颜色
        android:layout_margin="30px"                                      //距离左边30个像数的距离

            />

</LinearLayout>


string.xml的文件修改hello的值如下:

<resources>

    <string name="app_name">TextView</string>
    <string name="hello">Hello,This is My first Android Application</string>     //这行我是自己修改的
    <string name="menu_settings">Settings</string>
    <string name="title_activity_main">MainActivity</string>

</resources>


结果如下图所示:(我不知道怎么放图片)






  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值