- 博客(20)
- 收藏
- 关注
原创 Android文件操作
android的文件操作要有权限: view plaincopy to clipboardprint? <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"></uses-permission> <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"></uses-perm..
2021-11-06 22:36:06
369
原创 Android开发之ViewPager2
1、主界面xml文件<?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:ori
2021-11-05 09:40:08
1833
原创 Android开发之动态添加Fragment
1、创建Fragment子类public class Fragment1 extends Fragment { private View root; @Override public void onCreate(@Nullable Bundle savedInstanceState) { super.onCreate(savedInstanceState); } @Override public View onCreateView(@
2021-11-04 13:10:30
1485
原创 Android开发之静态添加Fragment
1、activity_main.xml<?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" an
2021-11-04 09:37:54
288
原创 Android开发之SQLiteOpenHelper
1、创建一个继承于SQLiteOpenHelper的子类public class SqliteHelper extends SQLiteOpenHelper { private static SqliteHelper instance; public static synchronized SqliteHelper getInstance(Context context) { if (instance == null) { instance =
2021-11-02 10:06:41
1450
原创 Android开发之openFileInput和openFileOutput
openFileOutput()首先给大家介绍使用文件如何对数据进行存储,Activity提供了openFileOutput()方法可以用于把数据输出到文件中,具体的实现过程与在J2SE环境中保存数据到文件中是一样的。public void save() { try { FileOutputStream outStream=this.openFileOutput(“a.txt”,Context.MODE_WORLD_READABLE);...
2021-10-30 22:12:56
869
原创 Android开发之ViewPage
public class MainActivity extends AppCompatActivity { private ViewPager viewPager; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); ...
2021-10-30 13:20:00
133
原创 Android开发之属性动画
ValueAnimator valueAnimator = ValueAnimator.ofFloat(0f, 1f); valueAnimator.setDuration(2000); valueAnimator.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() { @Override public void onAnimationUpd...
2021-10-30 11:35:41
89
原创 Android开发之补间动画
1、透明2、旋转3、缩放4、平移 image1.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) {// Animation animation = AnimationUtils.loadAnimation(MainActivity.this, R.anim...
2021-10-29 15:26:45
82
原创 Android 第三方包
okhttp: implementation("com.squareup.okhttp3:okhttp:4.9.0")jsoup: implementation 'org.jsoup:jsoup:1.14.3'
2021-10-29 13:22:55
119
原创 Android开发之ToolBar
1、设置资源文件themse.xml<androidx.appcompat.widget.Toolbar android:id="@+id/toolbar" android:layout_width="match_parent" android:layout_height="wrap_content" app:navigationIcon="@drawable/ic_baseline_arrow_back_ios_...
2021-10-29 11:23:42
130
原创 Android开发之Notification
nManager = (NotificationManager) getSystemService(NOTIFICATION_SERVICE); notification = new NotificationCompat.Builder(this, "12306") .setContentTitle("系统通知") .setContentText("世界这么大,好想出去走走!") .setSma.
2021-10-27 10:20:36
109
原创 Android开发之EditText
<EditText android:id="@+id/etxtName" android:layout_width="wrap_content" android:layout_height="wrap_content" android:background="#7777" android:drawableLeft="@drawable/ic_baseline_person_24" android...
2021-10-26 17:20:24
136
原创 Android开发之Spinner
1、在strings.xml加入数组2、代码部分 Spinner spinner = findViewById(R.id.spinner); ArrayAdapter<CharSequence> adapter = ArrayAdapter.createFromResource(this, R.array.list, android.R.layout.simple_spinner.
2021-10-26 15:13:03
263
原创 android开发之RecycleView
1、添加依赖包:implementation 'androidx.recyclerview:recyclerview:1.1.0'2、item.xml3、创建MyAdapter extentds Recyclerview.Adapter<MyAdapter.MyViewHolder>public class MyAdapter extends RecyclerView.Adapter<MyAdapter.MyViewHolder> { private Conte
2021-10-22 22:49:57
221
原创 android开发之listview
1.找到listview2.创建MyAdapter(继承BaseAdapter)public class MyAdapter extends BaseAdapter { private List<Bean> list; private Context context; private int num = 0; public MyAdapter(List<Bean> list, Context context) { this
2021-10-22 16:07:47
89
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人