寒假打卡day22

今天做了什么

教程第二天,建立主页面

在activity_main.xml里编写主界面布局
根据预览图,主界面需要一个ListView和一个ImageButton,还要给ImageButton添加一个Onclick事件,将按钮的UI图片tianjia.png放入drawable文件夹

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout 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:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".MainActivity">

<ListView
android:id="@+id/list_view"
android:layout_width="wrap_content"
android:layout_height="650dp"
/>

<ImageButton
android:id="@+id/add"
android:onClick="addAccount"
android:layout_width="80dp"
android:layout_height="80dp"
android:scaleType="centerInside"
android:layout_centerHorizontal="true"
android:background="#00FF0000"
android:src="@drawable/tianjia"
android:layout_below="@+id/list_view" />
</RelativeLayout>
————————————————

版权声明:本文为博主原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。

原文链接:https://blog.csdn.net/qq_40069099/article/details/106601588

posted @ 2024-02-18 18:45  夏季彼岸德  阅读(38)  评论(0)    收藏  举报