Android UI手机信息页面
2017-03-14 21:04
381 查看
1. 设计思路(实现原理)
1)将准备好的八个图标复制到res/drawable文件夹下
2)创建一个垂直的线性布局,并在线性布局中创建4个相对布局
3)在相对布局中添加相应的TextView
4))抽取样式
由于编写布局文件时,相同控件之间的外边距和宽高都是固定的。因此会产生大量重复的布局代码,为了代码简洁和重复使用可以将相同代码抽取为样式单独放在一个style.xml文件中在values文件下的style.xml。文件中存放抽取出来的样式如下
5)创建values-zh-rCN、values-en-rUS文件夹,并在文件夹中创建strings.xml文
2:案例实现
(1)创建“手机信息页面”程序
(2)与界面交互的代码:
3:(1)最后运行结果图
(2)点击绿色机器人(手机信息页面)显示界面如下:
1)将准备好的八个图标复制到res/drawable文件夹下
2)创建一个垂直的线性布局,并在线性布局中创建4个相对布局
3)在相对布局中添加相应的TextView
4))抽取样式
由于编写布局文件时,相同控件之间的外边距和宽高都是固定的。因此会产生大量重复的布局代码,为了代码简洁和重复使用可以将相同代码抽取为样式单独放在一个style.xml文件中在values文件下的style.xml。文件中存放抽取出来的样式如下
5)创建values-zh-rCN、values-en-rUS文件夹,并在文件夹中创建strings.xml文
2:案例实现
(1)创建“手机信息页面”程序
<?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_main" android:layout_width="match_parent" android:layout_height="match_parent" tools:context="cn.edu.bzu.phoneinfo.MainActivity" android:background="@android:color/darker_gray" android:orientation="vertical" > <RelativeLayout style="@style/h_wrap_content" android:layout_marginTop="10dp"> <TextView style="@style/tv_style" android:layout_alignParentLeft="true" android:layout_marginLeft="10dp" android:drawableTop="@drawable/clound" android:text="@string/_cloud" /> <TextView style="@style/tv_style" android:layout_alignParentRight="true" android:layout_marginRight="10dp" android:drawableTop="@drawable/bluetooth" android:text="@string/_bluetooth" /> </RelativeLayout> <RelativeLayout style="@style/h_wrap_content" android:layout_marginTop="10dp"> <TextView style="@style/tv_style" android:layout_alignParentLeft="true" android:layout_marginLeft="10dp" android:drawableTop="@drawable/gesture" android:text="@string/_gesture" /> <TextView style="@style/tv_style" android:layout_alignParentRight="true" android:layout_marginRight="10dp" android:drawableTop="@drawable/gps" android:text="@string/_gps" /> </RelativeLayout> <RelativeLayout style="@style/h_wrap_content" android:layout_marginTop="10dp"> <TextView style="@style/tv_style" android:layout_alignParentLeft="true" android:layout_marginLeft="10dp" android:drawableTop="@drawable/info" android:text="@string/_system_info" /> <TextView style="@style/tv_style" android:layout_alignParentRight="true" android:layout_marginRight="10dp" android:drawableTop="@drawable/internet" android:text="@string/_internet" /> </RelativeLayout> <RelativeLayout style="@style/h_wrap_content" android:layout_marginTop="10dp"> <TextView style="@style/tv_style" android:layout_alignParentLeft="true" android:layout_marginLeft="10dp" android:drawableTop="@drawable/language" android:text="@string/_language" /> <TextView style="@style/tv_style" android:layout_alignParentRight="true" android:layout_marginRight="10dp" android:drawableTop="@drawable/notifycation" android:text="@string/_set_notifycation" /> </RelativeLayout> </LinearLayout>
(2)与界面交互的代码:
package cn.ed 4000 u.bzu.phoneinfo; import android.support.v7.app.AppCompatActivity; import android.os.Bundle; public class MainActivity extends AppCompatActivity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); } }
3:(1)最后运行结果图
(2)点击绿色机器人(手机信息页面)显示界面如下:
相关文章推荐
- Android UI手机信息页面
- Android UI 手机信息页面
- Android UI 手机信息页面
- Android-UI 手机信息页面相关设计
- 实验3 Android UI 任务:手机信息页面
- Android UI 手机页面信息(布局、样式及程序国际化问题)
- Android UI——手机信息页面
- Android UI 手机信息页面
- Android UI手机信息页面
- 做一个Android UI手机信息页面
- Android-UI:一个手机页面信息
- Android UI---手机信息页面
- Android-UI :手机信息页面
- 实验:Android UI编写手机信息页面
- Android UI 手机信息页面
- Android UI中手机信息页面国际化
- Android UI手机信息页面
- Android UI 手机信息页面
- 手机信息页面制作(android UI)
- Android UI手机信息页面设计