android
oct-month
这个作者很懒,什么都没留下…
展开
-
android学习日记8 -- 自定义布局
示例先在drawable目录下新建了一个back.xml文件:<?xml version="1.0" encoding="utf-8"?><shape xmlns:android="http://schemas.android.com/apk/res/android" > <!-- 背景色 --> <solid android:col...原创 2019-11-13 17:16:22 · 96 阅读 · 0 评论 -
android学习日记7 -- 4种UI布局
线性布局示例代码:<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:orientation="horizontal" android:layout_width="match_parent" android:layout_height="match_par...原创 2019-11-13 16:22:36 · 107 阅读 · 0 评论 -
android学习日记6 -- 部分UI控件
TextView显示一段文字<TextView android:layout_width="match_parent" android:layout_height="wrap_content" android:gravity="center_vertical|center_horizontal" android:textSize="24sp" android:text...原创 2019-11-12 21:02:33 · 90 阅读 · 0 评论 -
android学习日记5 -- 监听事件
注册监听器Button button = (Button)findViewById(R.id.button);button.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { //... }}传入的参数是一个View.onClickListener对象。...原创 2019-11-12 18:32:14 · 122 阅读 · 0 评论 -
android学习日记4 -- 活动的生存期
返回栈Android中的活动是栈式管理(Task)的,每启动一个新活动,就会将新活动入栈,按back键又会销毁最上面的活动,而Android显示的活动就是栈顶活动。关于生存期的回调方法onCreate()onStart()onResume()onPause()onStop()onDestroy()onRestart()可以在类中重写这些方法。活动被系统回收的处理方式重写...原创 2019-11-12 17:59:01 · 79 阅读 · 0 评论 -
android学习日记3 -- intent
显式intentIntent intent = new Intent(FirstActivity.this,SecondActivity.class);//第一个参数为启动活动的Context, 第二个为想要启动的活动的 ClassstartActivity(intent); //启动活动在FIrstActivity的基础上打开SecondActivitystartActiv...原创 2019-10-30 21:22:37 · 111 阅读 · 0 评论 -
andriod学习日记2 -- 活动中的其它元素
Toastimport android.widget.Toast;Toast.makeText(FirstActivity.this, "test", Toast.LENGTH_SHORT).show();第一个参数为活动本身,第二个为消息内容,第三个是显示时长(Toast.LENGTH_SHORT, Toast.LENGTH_LONG)。该段代码会弹出一些短小的通知信息 ‘test’...原创 2019-10-30 18:15:07 · 87 阅读 · 0 评论 -
andriod学习日记1 -- 项目起步
创建项目1、选择 Add No Activity2、配置gradle,jcenterhttps://blog.csdn.net/weixin_44972911/article/details/1027271323、右上角sync 按钮等待项目创建完毕创建活动app/src/main/java/com.example.*右键 New-Activity-Empty Activity勾选...原创 2019-10-30 00:38:10 · 240 阅读 · 0 评论