1.创建程序: <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" tools:conte…
1.创建程序activity_main: <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="vertical"> <Line…
client.xml <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="vertical" > <TextView androi…
注册 package com.scme.ui; import android.app.Activity; import android.content.Intent; import android.os.Bundle; import android.view.View; import android.view.View.OnClickListener; import android.widget.Button; import android.widget.EditText; import and…
看了下,上次学习android还是17年的事情,,,,两年过去了我现在终于来搞android了... 官网有一段基础描述: https://developer.android.google.cn/guide/components/fundamentals Android 应用采用 Java 编程语言编写.Android SDK 工具将您的代码 — 连同任何数据和资源文件 — 编译到一个 APK:Android 软件包,即带有 .apk 后缀的存档文件中.一个 APK 文件包含 Android 应…
onSaveInstanceState 保存 在暂停之后和保存之前调用 onRestoreInstanceState 恢复 再启动之后和显示之前调用 package com.example.chenshuai.excise; import android.app.Activity; import android.content.Intent; import android.os.Bundle; import android.util.Log; import android.view.View;…
了解了5大布局,我们会发现这些布局都是静态的,如何让系统自动生成控件呢?这就需要activity来帮忙了 今天我们讲的就是用activity新建布局 用案例来说吧! 实现一个输入行和列自动生成表格并生成背景颜色 效果如图 代码如下: <?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/a…
为了管理Activity中的fragments,需要使用FragmentManager,为了得到它,需要调用Activity中的getFragmentManager()方法,接下来详细介绍,感兴趣的朋友可以了解下哦 FragmentManager 为了管理Activity中的fragments,需要使用FragmentManager. 为了得到它,需要调用Activity中的getFragmentManager()方法. 因为FragmentManager的API是在Android 3.0,也即…
在自己写的一个小应用中发现一个问题,当调出输入法后界面最下方的一个按钮被挤到了输入法的上面,这样很不美观,所以找了一下解决办法记录如下: 在AndroidManifest.xml文件中找到对应的activity添加该属性:android:windowSoftInputMode. 该属性做两件事: 1:当用户使该activity获得焦点时决定软键盘是隐藏还是显示. 2:当软键盘出来时activity是否重新调整大小以适应软键盘和输入的内容. 添加方法: android:windowSoftInpu…
android从手机数据库中取音乐数据 直接贴代码 public void getMp3(){ list = new ArrayList<>(); Cursor mAudioCursor = this.getContentResolver().query( MediaStore.Audio.Media.EXTERNAL_CONTENT_URI, null,// 字段 没有字段 就是查询全部信息 相当于SQL语句中的 " * " null, // 查询条件 null, //…