1、activity_main.xml

  描述:构建一个按钮

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/activity_main"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent"> <Button
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="TextView"
android:onClick="test_1"/> </LinearLayout>

2、MainActivity.java

  描述:页面跳转

package com.example.android_ui;
import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View; public class MainActivity extends Activity { @Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
} public void test_1(View view){
Intent intent=new Intent(this,TextViewActivity.class);
startActivity(intent);
}
}

3、修改res资源目录下的values包中的strings.xml文件

  描述:

    在activity_text_view.xml文件中会应用 15015910994 这个电话号码  

<resources>
<string name="app_name">Android_UI</string>
<string name="police">15019948551</string> <array name="jobs">
<item>法师</item>
<item>坦克</item>
<item>射手</item>
<item>刺客</item>
</array>
</resources>

3、activity_text_view.xml

  描述:

    第一个TextView中:

      1、android:autoLink="phone"  表示自动拨打电话

      2、android:text="@string/police" 表示引用strings.xml文件中的电话号码

    第二个TextView中:

      1、android:autoLink="web"  表示自动打开网址

      2、android:text="http://192.168.0.168"  设置网络地址

    第三个EditText组件中:

      1、android:maxLines="1"  设置用户输入的信息不换行,即用户输入的信息只能在一行显示

      2、android:inputType="phone"  设置该输入框只能输入电话号码,即数字

    第四个EditText组件中:

      1、android:inputType="text"  设置该输入框只能输入文本内容

    第五个EditText组件中:

      1、android:inputType="textPassword"设置该输入框中只能输入密码

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/activity_text_view"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"> <TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/police"
android:textSize="30sp"
android:gravity="center"
android:autoLink="phone"
/>
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="http://192.168.0.168"
android:textSize="30sp"
android:gravity="center"
android:autoLink="web"
/>
<EditText
android:layout_width="match_parent"
android:layout_height="60dp"
android:hint="请输入电话号码"
android:maxLines="1"
android:inputType="phone"
/>
<EditText
android:layout_width="match_parent"
android:layout_height="60dp"
android:hint="请输入姓名"
android:maxLines="1"
android:inputType="text"
/>
<EditText
android:layout_width="match_parent"
android:layout_height="60dp"
android:hint="请输密码"
android:maxLines="1"
android:inputType="textPassword"
/>
</LinearLayout>

4、TextViewActivity.java

  描述:无操作

package com.example.android_ui;

import android.app.Activity;
import android.os.Bundle; public class TextViewActivity extends Activity { @Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_text_view);
}
}

Android开发---基本UI组件1:自动拨电话,自动上网,输入框不换行、只输数字、只输文本、只输密码的更多相关文章

  1. Android开发 ---基本UI组件4:拖动事件、评分进度条、圆圈式进度条、进度条控制

    Android开发 ---基本UI组件4 1.activity_main.xml 描述: 定义了一个按钮 <?xml version="1.0" encoding=" ...

  2. Android开发 ---基本UI组件3:单选按钮、多选按钮、下拉列表、提交按钮、重置按钮、取消按钮

    Android开发 ---基本UI组件2 1.activity_main.xml 描述: 定义一个用户注册按钮 <?xml version="1.0" encoding=&q ...

  3. Android开发 ---基本UI组件2:图像按钮、单选按钮监听、多选按钮监听、开关

    Android开发 ---基本UI组件2 1.activity_main.xml 描述: 定义一个按钮 <?xml version="1.0" encoding=" ...

  4. Android开发 ---基本UI组件8:九宫格布局、setOnItemClickListener()项被选中监听事件

    效果图: 1.activity_main.xml 描述: 定义了一个按钮 <?xml version="1.0" encoding="utf-8"?> ...

  5. Android开发 ---基本UI组件6 :只定义一个listView组件,然后通过BaseAdapter适配器根据数据的多少自行添加多个ListView显示数据

    效果图: 1.activity_main.xml 描述: 定义了一个按钮 <?xml version="1.0" encoding="utf-8"?> ...

  6. Android开发 ---基本UI组件7 :分页功能、适配器、滚动条监听事件

    效果图: 1.activity_main.xml 描述: 定义了一个按钮 <?xml version="1.0" encoding="utf-8"?> ...

  7. Android开发 ---基本UI组件5:监听下拉选项,动态绑定下拉选项、全选/反选,取多选按钮的值,长按事件,长按删除,适配器的使用,提示查询数据,activity控制多按钮

    效果图: 效果描述: 1.当点击 1 按钮后,进入选择城市的页面,会监听到你选中的城市名称:动态为Spinner绑定数据 2.当点击 2 按钮后,进入自动查询数据页面,只要输入首字母,就会动态查找以该 ...

  8. ReactNative Android之原生UI组件动态addView不显示问题解决

    ReactNative Android之原生UI组件动态addView不显示问题解决 版权声明:本文为博主原创文章,未经博主允许不得转载. 转载请表明出处:http://www.cnblogs.com ...

  9. android开发之自定义组件

    android开发之自定义组件 一:自定义组件: 我认为,自定义组件就是android给我们提供的的一个空白的可以编辑的图片,它帮助我们实现的我们想要的界面,也就是通过自定义组件我们可以把我们要登入的 ...

随机推荐

  1. GWAS | 全基因组关联分析 | Linkage disequilibrium (LD)连锁不平衡 | 曼哈顿图 Manhattan_plot | QQ_plot | haplotype phasing

    现在GWAS已经属于比较古老的技术了,主要是碰到严重的瓶颈了,单纯的snp与表现的关联已经不够,需要具体的生物学解释,这些snp是如何具体导致疾病的发生的. 而且,大多数病找到的都不是个别显著的snp ...

  2. English Voice of << Last Christmas >>

    Last Christmas填 词:乔治·迈克尔谱 曲:乔治·迈克尔编 曲:乔治·迈克尔歌词:Last Christmas I gave you my heart去年的圣诞节,我把心给了你But th ...

  3. 微信小程序双击事件的绑定

  4. 获取在线python 文档

    window cmd    :python -m pydoc -p 8888

  5. linux中的软、硬链接

    linux中的软.硬链接 硬链接 硬链接(hard link),如果文件B是文件A的硬链接,则A的inode节点号与B的inode节点号相同,即一个inode节点对应两个不同的文件名,两个文件名指向同 ...

  6. Ugly Number II leetcode java

    问题描述: Write a program to find the n-th ugly number. Ugly numbers are positive numbers whose prime fa ...

  7. loj#2353. 「NOI2007」 货币兑换 斜率优化

    题意略 题解:可以列出dp方程\(dp[i]=max(dp[j]*{\frac{a[i]*c[j]+b[i]}{a[j]*c[j]+b[j]}}\),化简可以得到\(\frac{dp[i]}{b[i] ...

  8. set unused的用法(ORACLE删除字段)

    set unused的用法(ORACLE删除字段) 一.问题 现场有一张大数据量的分区表,数据量在10G以上.因某种原因需要删除其中的某些字段.如果直接用alter table1 drop (colu ...

  9. 解决jar包依赖:Spring IO platform推出bom

    名词解释: BOM(bill of materials):材料清单,用于解决jar包依赖的好方法. Spring IO Platform 缘起:Spring起初只专注ioc和aop,现在已发展成一个庞 ...

  10. linux LVM详解

    1.创建及删除步骤1)创建:linux partition-->pv-->vg-->lv-->fs-->mount2)删除:umount-->lv-->vg- ...