二、Android平台搭建与简单应用设计

前面我们安装了Android studio应用并简单创建了helloworld项目,下面再来进一步学习,也很简单,学习内容如下:

(1)创建一个简单的项目,输出“你好啊,这是我的第一个安卓项目!”

(2)创建项目,使用表格布局管理器放置组件,界面如下图所示:

 一、创建一个简单的项目,输出“你好啊,这是我的第一个安卓项目!”

这个其实很简单,直接在“activity_main.xml”中修改“TextView”的文本内容就好了,默认是HelloWorld。

然后直接输出:

 二、创建项目,使用表格布局管理器放置组件,界面如下图所示。

只需要设计布局,所以需要在“activity_main.xml”中编写语句就好了,这里选择表格约束,具体代码如下:

<TableLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent">
<TableRow>
    <TextView
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="手  机  号:"
        android:textColor="#004"
        android:textSize="17sp"
        android:paddingLeft="16dp"/>
    <EditText
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:hint="请填写手机号码"
        android:paddingLeft="8dp"
        android:selectAllOnFocus="true"/>
</TableRow>
<TableRow>
    <TextView
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="密        码:"
        android:textColor="#004"
        android:paddingLeft="16dp"
        android:textSize="16sp"/>
    <EditText
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:hint="请填写密码"
        android:paddingLeft="8dp"
        android:selectAllOnFocus="true"/>
</TableRow>
<TableRow>
    <TextView
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="确认密码:"
        android:paddingLeft="16dp"
        android:textColor="#004"
        android:textSize="16sp"/>
    <EditText
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:hint="请确定密码"
        android:paddingLeft="8dp"
        android:selectAllOnFocus="true"/>
</TableRow>
<TableRow>
    <TextView
        />
    <Button
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="取消"
        />
    <Button
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="确认"
        />
</TableRow>

</TableLayout>

然后输出:

over, 这只是简单的界面布局的代码,刚开始尝试去理解下,后面用Java代码添加事件才是难点哦,不过慢慢来总是可以的。

  • 1
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

硬核的无脸man~

你的鼓励是我创作的最大功力!

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值