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