手机信息页面的制作运行

通过代码实现,需要得出以下结果图
这里写图片描述
1)将准备好的八个图标复制到res/drawable文件夹下
这里写图片描述
2)创建一个垂直的线性布局,并在线性布局中创建4个相对布局 且在相对布局中添加相应的TextView
代码实现如下:

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:background="@android:color/darker_gray"
    android:orientation="vertical"
    tools:context=".MainActivity">

    <RelativeLayout
        style="@style/lly_wrap_content"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_marginTop="10dp">

        <TextView
            style="@style/ly_style"
            android:layout_alignParentLeft="true"
            android:layout_marginLeft="20dp"
            android:layout_weight="1"
            android:drawableTop="@drawable/clound"
            android:text="@string/_cloud" />

        <TextView
            style="@style/ly_style"
            android:layout_alignParentRight="true"
            android:layout_marginRight="20dp"
            android:layout_weight="1"
            android:drawableTop="@drawable/bluetooth"
            android:text="@string/_bluetooth" />
    </RelativeLayout>

    <RelativeLayout
        style="@style/lly_wrap_content"
        android:layout_marginTop="10dp">

        <TextView
            style="@style/ly_style"
            android:layout_alignParentLeft="true"
            android:layout_marginLeft="20dp"
            android:layout_weight="1"
            android:drawableTop="@drawable/gesture"
            android:text="@string/_gesture" />

        <TextView
            style="@style/ly_style"
            android:layout_alignParentRight="true"
            android:layout_marginRight="20dp"
            android:layout_weight="1"
            android:drawableTop="@drawable/gps"
            android:text="@string/_gps" />
    </RelativeLayout>

    <RelativeLayout
        style="@style/lly_wrap_content"
        android:layout_marginTop="10dp">

        <TextView
            style="@style/ly_style"
            android:layout_alignParentLeft="true"
            android:layout_marginLeft="20dp"
            android:layout_weight="1"
            android:drawableTop="@drawable/info"
            android:text="@string/_system_info" />

        <TextView
            style="@style/ly_style"
            android:layout_alignParentRight="true"
            android:layout_marginRight="20dp"
            android:layout_weight="1"
            android:drawableTop="@drawable/internet"
            android:text="@string/_internet" />
    </RelativeLayout>

    <RelativeLayout
        style="@style/lly_wrap_content"
        android:layout_marginTop="10dp">

        <TextView
            style="@style/ly_style"
            android:layout_alignParentBottom="true"
            android:layout_alignParentLeft="true"
            android:layout_marginLeft="20dp"
            android:layout_weight="1"
            android:drawableTop="@drawable/language"
            android:text="@string/_language" />

        <TextView
            style="@style/ly_style"
            android:layout_alignParentRight="true"
            android:layout_marginRight="20dp"
            android:layout_weight="1"
            android:drawableTop="@drawable/notifycation"
            android:text="@string/_set_notifycation" />
    </RelativeLayout>
</LinearLayout>

3)在values文件下的style.xml文件中存放抽取出来的样式
代码如下:

<!-- Base application theme. -->
<style name="Theme" parent="Theme.AppCompat.Light.DarkActionBar">
    <!-- Customize your theme here. -->
    <item name="colorPrimary">@color/colorPrimary</item>
    <item name="colorPrimaryDark">@color/colorPrimaryDark</item>
    <item name="colorAccent">@color/colorAccent</item>
</style>

<style name="AppBaseTheme" parent="android:Theme.Light"></style>

<style name="AppTheme" parent="AppBaseTheme"></style>

<style name="lly_wrap_content">
    <item name="android:layout_width">match_parent</item>
    <item name="android:layout_height">wrap_content</item>
</style>

<style name="ly_style">
    <item name="android:layout_width">150dp</item>
    <item name="android:layout_height">120dp</item>
    <item name="android:gravity">center</item>
    <item name="android:paddingTop">8dp</item>
    <item name="android:paddingBottom">8dp</item>
    <item name="android:drawablePadding">5dp</item>
    <item name="android:background">@android:color/white</item>
</style>

“`
4)创建values-zh-rCN、values-en-rUS文件夹,并在文件夹中创建strings.xml
中文版:这里写图片描述
英文版:这里写图片描述
5)经过调试,最终实现效果图
这里写图片描述
完成后,就可以正常实现了。

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值