2.10Android 学习

我们要设置图标和名称只需要修改这三个值就就可以了

        android:icon="@drawable/appimag"
        android:label="记账本"
        android:roundIcon="@drawable/appimag"

然后最后的效果是这样的

 

 

 

 源代码:

复制代码
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    xmlns:tools="http://schemas.android.com/tools"
    android:id="@+id/main"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:orientation="vertical"
    android:gravity="center"
    tools:context=".MainActivity">

    <include layout="@layout/list_name" />
    <View

        android:layout_width="fill_parent"
        android:layout_marginTop="0dp"
        android:layout_height="1dp"
        android:layout_marginLeft="5dp"
        android:layout_marginRight="5dp"
        android:background="#aa000000" />

    <ListView
        android:id="@+id/list_view"
        android:layout_width="wrap_content"
        android:layout_height="650dp"
        />
    <View
        android:layout_width="fill_parent"
        android:layout_marginTop="10dp"
        android:layout_height="1dp"
        android:layout_marginLeft="5dp"
        android:layout_marginRight="5dp"
        android:background="#aa000000" />
    <include layout="@layout/total"/>

</LinearLayout>
复制代码
复制代码
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
    xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:orientation="vertical"
    android:gravity="center">
    <TextView
        android:layout_width="wrap_content"
        android:layout_height="50dp"
        android:gravity="left"
        android:singleLine="true"
        android:textSize="40sp"
        android:ellipsize="marquee"
        android:text="添加新条目" />
    <Space
        android:layout_width="wrap_content"
        android:layout_height="30dp"/>
    <View
        android:layout_width="fill_parent"
        android:layout_marginTop="0dp"
        android:layout_height="1dp"
        android:layout_marginLeft="5dp"
        android:layout_marginRight="5dp"
        android:background="#aa000000" />
    <Space
        android:layout_width="wrap_content"
        android:layout_height="20dp"/>

    <Spinner
        android:id="@+id/spin"
        android:layout_marginLeft="3sp"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        />
    <Space
        android:layout_width="wrap_content"
        android:layout_height="20dp"/>

    <EditText
        android:id="@+id/et_cost_title"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_margin="4dp"
        android:hint="事项说明"
        android:textColor="#ffbd27"
        />
    <Space
        android:layout_width="wrap_content"
        android:layout_height="10dp"/>
    <EditText
        android:id="@+id/et_cost_money"
        android:inputType="number|numberDecimal"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_margin="4dp"
        android:hint="金额(元)"
        android:textColor="#ffbd27"
        />

    <Space
        android:layout_width="wrap_content"
        android:layout_height="20dp"/>
    <DatePicker
        android:id="@+id/dp_cost_date"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:datePickerMode="spinner"
        android:calendarViewShown="false"
        />
    <Space
        android:layout_width="wrap_content"
        android:layout_height="50dp"/>
    <Button
        android:onClick="okButton"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:text="确认"
        android:textSize="20dp"
        android:textColor="#333333"
        android:background="#ffbd27"
        android:layout_marginLeft="40dp"
        android:layout_marginRight="40dp"
        />
    <Space
        android:layout_width="wrap_content"
        android:layout_height="20dp"/>
</LinearLayout>
 
posted @ 2024-02-28 14:06  new菜鸟  阅读(6)  评论(0)    收藏  举报