FrameLayout:所有东西依次都放在左上角,会重叠,这个布局比较简单,也只能放一点比较简单的东西。

LinearLayout:线性布局,每一个LinearLayout里面又可分为垂直布局(Android:orientation=“vertical”)和水平布局(android:orientation=“horizontal” )。当垂直布局时,
每一行就只有一个元素,多个元素依次垂直往下;水平布局时,只有一行,每一个元素依次向右排列。

AbsoluteLayout:绝对布局用X,Y坐标来指定元素的位置,这种布局方式也比较简单,但是在屏幕旋转时,往往会出问题,而且多个元素的时候,计算比较麻烦。

RelativeLayout:相对布局可以理解为某一个元素为参照物,来定位的布局方式。主要属性有:相对于某一个元素android:layout_below、android:layout_toLeftOf,相对

于父元素的地方android:layout_alignParentLeft、android:layout_alignParentRigh。

GridLayout(TableLayout):表格布局,每一个TableLayout里面有表格行TableRow,TableRow里面可以具体定义每一个元素 https://www.it610.com/article/5335982.htm

1.android stdio:出现Expecting member declaration 原因
新建project的时候,language项选错了,应选java
2.Cannot resolve symbol ‘View’ 改为 android.view.View

NEW View.OnClickListener
均匀分配:
android:layout_height=“wrap_content”
android:layout_weight=“1”
网络编程:https://blog.csdn.net/fightingXia/article/details/71775516
http://m.biancheng.net/view/3153.html
正则表达式:https://www.cnblogs.com/275147378abc/p/4581580.html
https://www.sojson.com/regex/generate
http://c.biancheng.net/view/830.html
http://c.biancheng.net/view/830.html

1.匿名内部类 button2.setOnClickListener(new View.OnClickListener() {}
2.主类中(Activity活动)实现View.OnClickListener接口
3.创建内部类,实现View.OnClickListener接口。
4.在布局文件中为该View设置android:onClick属性指定点击的方法名。此时,将点击事件的事件名交给了视图,告诉它该控件遇到点击时间时候要依据哪个函数。
5.外部类
6.Button.OnClickListener b=new Button.OnClickListener(){}

用网页打开app

            "Content-Type" content="text/html; charset=UTF-8">        Insert title here                "m://my.com/">打开app

intent

<?xml version="1.0" encoding="utf-8"?>

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">

package com.example.learnintent;

import androidx.appcompat.app.AppCompatActivity;

import android.os.Bundle;
import android.view.MotionEvent;
import android.view.View;
import android.widget.*;

public class MainActivity extends AppCompatActivity {
private TextView textview;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
textview=(TextView)findViewById(R.id.textview);

    textview.setOnTouchListener(new View.OnTouchListener() {        @Override        public boolean onTouch(View v, MotionEvent event) {            int action=event.getAction();            switch(action){                case MotionEvent.ACTION_DOWN:                    //display("",event);                    textview.setText("点击屏幕");                    float pressure=event.getPressure();                    String msg=String.valueOf(pressure);                    textview.setText(msg);                                            break;            }            return false;        }    });}

}

//例1——打开浏览器
Intent intent = new Intent();
intent.setAction(“android.intent.action.VIEW”);
intent.setData(Uri.parse(“http://www.baidu.com”));
startActivity(intent);

android:icon="@mipmap/ic_launcher" //应用或活动的图标
android:label="@string/app_name" //应用或活动的标题

action=main 主入口
category=LAUNCHER启动 LAUNCHER发射器,项目启动先打开此Activity

Intent intent = new Intent(select.this, skip.class); startActivity(intent);

Uri uri = Uri.parse(“https://www.baidu.com”);Intent intent = new Intent(Intent.ACTION_VIEW, uri);startActivity(intent);

文件存储:
读取:
FileInputStream in=openFileInput(“flag”);
BufferedReader reader=new BufferedReader(new InputStreamReader(in));

        StringBuffer content=new StringBuffer();

String line=""; while((line=reader.readLine())!=null){content.append(line);} String A=content.toString();
reader.close();
写入:
FileOutputStream out;
BufferedWriter writer;
try {
out=openFileOutput(“flag”, Context.MODE_PRIVATE);
writer=new BufferedWriter(new OutputStreamWriter(out));
writer.write(“1”);
writer.close();
共享优先:
写入:
final SharedPreferences sp = getSharedPreferences(“m”, MODE_PRIVATE);
final SharedPreferences.Editor editor = sp.edit();
editor.putString(“pre”,s);
editor.commit();

读取:
final SharedPreferences s = getSharedPreferences(“m”, MODE_PRIVATE);
String str = s.getString(“pre”,“2019/12/31 00:00:00:000”);
default

public class SmsReceiver extends BroadcastReceiver { public void onReceive(Context arg0, Intent arg1) {}}

更多相关文章

  1. Android应用借助LinearLayout实现垂直水平居中布局
  2. android 3D系列之光效篇
  3. 模仿墨迹天气设置界面布局
  4. Android学习中一些小项目(连载中)
  5. LinearLayout布局中如何让控件置底
  6. android 基本布局(RelativeLayout、TableLayout等)使用方法及各种
  7. [UI]抽屉菜单DrawerLayout分析(一)
  8. android中AlertDialog设置圆角
  9. 移动开发:Android官方提供的支持不同屏幕大小的全部方法

随机推荐

  1. Android SDK下载慢的最给力解决办法
  2. Android项目结构和AndroidManifest.xml
  3. Android 之 ContentProvider的简介-相关
  4. android仿美团底部导航栏的点击效果——
  5. 【Android】Android Studio 1.5+ 中混合
  6. Android 应用程序中使用 Internet 数据
  7. Android 用SlidingDrawer实现抽屉效果
  8. android小复习
  9. 学习Android 应注意的十个问题
  10. Google Android操作系统四大特点