随笔分类 -  Android Studio

1
摘要:1.创建一个待处理的fragment 2.获取FragmentManager,一般都是通过getSupportFragmentManager() 3.开启一个事务transaction,一般调用fragmentManager的beginTransaction() 4.使用transaction进行f 阅读全文
posted @ 2023-05-08 23:59 会秃头的小白 阅读(22) 评论(0) 推荐(0)
摘要:使用流程: 1.定义ViewPager 2.为ViewPager创建Adapter ViewPagerAdapter package com.example.viewpagerandfragment; import android.view.LayoutInflater; import androi 阅读全文
posted @ 2023-04-13 15:06 会秃头的小白 阅读(259) 评论(0) 推荐(0)
摘要:在MainActivity中设置发送的信息,在fragment中接收, @Override public void onClick(View view) { switch (view.getId()){ case R.id.btn: Bundle bundle= new Bundle(); bund 阅读全文
posted @ 2023-04-12 21:47 会秃头的小白 阅读(51) 评论(0) 推荐(0)
摘要:activity_main.xml <?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://sc 阅读全文
posted @ 2023-04-12 21:32 会秃头的小白 阅读(36) 评论(0) 推荐(0)
摘要:public class MainActivity extends AppCompatActivity implements View.OnClickListener { private Context mContext; private Button btn_insert; private But 阅读全文
posted @ 2023-04-09 23:54 会秃头的小白 阅读(31) 评论(0) 推荐(0)
摘要:这个方法整体感觉太麻烦,每次都得重新保存一下数据库,在用插件显示出来。 在MainActivity中写上添加的代码 Button add = (Button) findViewById(R.id.add); add.setOnClickListener(new View.OnClickListene 阅读全文
posted @ 2023-04-09 21:05 会秃头的小白 阅读(48) 评论(0) 推荐(0)
摘要:修改的地方 1.MydatabaseHelper中的onUpgrade: 增加了两条语句,并且执行onCreate方法 2.MainActivity中将版本号改成2 阅读全文
posted @ 2023-04-09 20:39 会秃头的小白 阅读(21) 评论(0) 推荐(0)
摘要:activity_main.xml <?xml version="1.0" encoding="utf-8"?> <androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/ 阅读全文
posted @ 2023-04-09 20:25 会秃头的小白 阅读(21) 评论(0) 推荐(0)
摘要:activity_main.xml <?xml version="1.0" encoding="utf-8"?> <androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/ 阅读全文
posted @ 2023-03-29 16:13 会秃头的小白 阅读(12) 评论(0) 推荐(0)
摘要:activity_main.xml <?xml version="1.0" encoding="utf-8"?> <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_wid 阅读全文
posted @ 2023-03-29 16:11 会秃头的小白 阅读(17) 评论(0) 推荐(0)
摘要:frame.xml package com.example.listview; import androidx.appcompat.app.AppCompatActivity; import android.os.Bundle; import android.util.Log; import and 阅读全文
posted @ 2023-03-29 16:09 会秃头的小白 阅读(15) 评论(0) 推荐(0)
摘要:activity_main.xml package com.example.listview; import android.content.Context; import android.util.Log; import android.view.LayoutInflater; import an 阅读全文
posted @ 2023-03-29 11:29 会秃头的小白 阅读(11) 评论(0) 推荐(0)
摘要:<?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" an 阅读全文
posted @ 2023-03-29 11:27 会秃头的小白 阅读(13) 评论(0) 推荐(0)
摘要:<?xml version="1.0" encoding="utf-8"?> <GridLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="wrap_content" andr 阅读全文
posted @ 2023-03-29 11:27 会秃头的小白 阅读(20) 评论(0) 推荐(0)
摘要:<?xml version="1.0" encoding="utf-8"?> <FrameLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" and 阅读全文
posted @ 2023-03-29 11:26 会秃头的小白 阅读(13) 评论(0) 推荐(0)
摘要:<?xml version="1.0" encoding="utf-8"?> <androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android" x 阅读全文
posted @ 2023-03-29 11:25 会秃头的小白 阅读(30) 评论(0) 推荐(0)
摘要:notificationManager = (NotificationManager) getSystemService(NOTIFICATION_SERVICE); if(Build.VERSION.SDK_INT>=Build.VERSION_CODES.O){ NotificationChan 阅读全文
posted @ 2023-03-23 23:52 会秃头的小白 阅读(27) 评论(0) 推荐(0)
摘要:<androidx.appcompat.widget.Toolbar android:background="#ffff00" app:navigationIcon="@drawable/baseline_close_24" app:title="主标题" android:id="@+id/tb" 阅读全文
posted @ 2023-03-23 23:51 会秃头的小白 阅读(121) 评论(0) 推荐(0)
摘要:<Button android:layout_width="wrap_content" android:layout_height="wrap_content" android:onClick="sendNotification" android:text="发出通知" /> <Button and 阅读全文
posted @ 2023-03-23 23:42 会秃头的小白 阅读(11) 评论(0) 推荐(0)
摘要:android:id="@+id/tv_one" android:text="@string/tv_one" android:textColor="#FF000000" android:textSize="30sp" android:layout_width="match_parent" andro 阅读全文
posted @ 2023-03-17 19:38 会秃头的小白 阅读(17) 评论(0) 推荐(0)

1