Android UI(编辑手机信息页面,中英文切换)

一、实验所需图片

    

       

      


二、实验大概步骤思路

1.将准备好的八个图标复制到drawable文件夹下;

2.本次实验用线性布局与相对布局;

3.注意重点创建values-zh-rCNvalues-en-rUS文件夹;

4.最后的效果图如下所示:

Android UI(编辑手机信息页面,中英文切换)_第1张图片 

(英文条件下)

Android UI(编辑手机信息页面,中英文切换)_第2张图片

(中文条件下)

三、操作具体步骤:

1.创建“手机信息页面”,即main activity,主要是展示手机页面。

如下:

  1)线性布局为垂直显示:orientation="vertical"

    背景为:background="@android:color/darker_gray"

 2)在垂直的线性布局下添加四个线性布局,并在每个线性布局中添加两个文本

TextView,并分别如下设置

   第一个  

            style="@style/tv_style"

            android:layout_alignParentLeft="true"

            android:layout_marginLeft="10dp"

            android:drawableTop="@drawable/clound"

            android:text="@string/_cloud" />

 第二个    

            style="@style/tv_style"

            android:layout_alignParentRight="true"

            android:layout_marginRight="10dp"

            android:drawableTop="@drawable/bluetooth"

            android:text="@string/_bluetooth" />

其中各个TextView的drawableTop和text的设置不一。

drawable为图片,string为名字

2.创建values-zh-rCN、values-en-rUS文件夹。

1)在res目录下创建创建values-zh-rCN(中文)、values-en-rUS(英文)文件夹;

2)创建俩个文件夹后并在文件夹下创建相应的strings.xml文件夹。

其中中文中的strings如下:

    手机信息页面

    设置

    你好,世界!

    云通信

    蓝牙

    自定义手势

    定位

    系统信息

    网络

    语言设置

    通知栏设置

英文的strings如下:

    phoneInfo

    Settings

    Hello world!

    Cloud

     Bluetooth

    Gesture

    Gps

    SystemInfo

    Internet

    Language

    Notifycation

此两条strings分别定义了中英文状态下的app_name,menu_settings,hello_world,

_cloud,_bluetooth,_gesture,_gps,_system_info,_internet,_language,

_set_notifycation。便于中英文状态下的切换。

3、设置页面间距。

在style.xml文件夹下编写如下:

    

    

    

    

4.点开project下的MainActivity文件夹可以看到已经编写好的交互的代码。

5.调试,修改错误并运行。









你可能感兴趣的:(Android)