当前位置:网站首页>Detailed analysis of viewpager usage
Detailed analysis of viewpager usage
2022-04-22 08:29:00 【GuoXuan_ CHN】
The original address is : http://blog.csdn.net/urchin_dong/article/details/50712024
ViewPager Detailed explanation
- ViewPager The main methods in
- OnPageChangeListener Explain in detail the three methods in
- The use of three adapters and their main methods are explained in detail
ViewPager Used to switch between pages .
ViewPager The main methods in
setAdapter(PagerAdapter adapter)
The method for ViewPager Setup adapter ,ViewPager There are three adapters , They have different characteristics , Now I will explain these three adapters .setCurrentItem(int item)
This method sets the display item Location interface .setOffscreenPageLimit(int limit)
This method is used to set the number of cached pages on the left and right sides of the currently displayed page .addOnPageChangeListener(OnPageChangeListener listener)
The method for ViewPager Add listening during page switching , About interface monitoring , And then to OnPageChangeListener When explaining the method in , Let's go into more detail .setOnScrollChangeListener(OnScrollChangeListener l)
The method for ViewPager Add scroll status monitoring , But this method requires minSdkVersion by 23
OnPageChangeListener Explain in detail the three methods in
onPageScrollStateChanged(int state)
This method changes when the finger operates the screen . There are three values :0(END),1(PRESS) ,2(UP) . When you flip pages with your fingers , This method is triggered when the finger is pressed down ,state The value is 1, When the fingers are raised , If there's a slip ( Even if it's small ), This value will change to 2, And then it turns out to be 0 . Three times in total . One special case is that the finger does not slide at all after it is pressed down , This method will only be called twice at this time ,state Values are respectively 1,0 . When setCurrentItem When turning pages , This method will be executed twice ,state Values, respectively 2 ,0 .onPageScrolled(int position, float positionOffset, int positionOffsetPixels)
This method will always be called during sliding , The parameters of this method are described as follows :
position: When you slide with your fingers , If you hold your finger on the page ,position And the current page index It's consistent ; If you drag your finger to the left ( The corresponding page turns to the right ), Now position Most of the time, it is consistent with the current page , Only when page flipping is successful, the last call will become the target page ; If you drag your finger to the right ( Flip the corresponding page to the left ), Now position Most of the time, it's consistent with the target page , Only in the case of unsuccessful page turning, the last call will become the original page . When setting directly setCurrentItem When turning pages , If it's adjacent ( For example, now is the second page , Jump to the first or third page ), If you flip the page to the right , Most of the time is consistent with the current page , Only in the end will it become the target page ; If you flip to the left ,position Consistent with the target page . This is basically the same as flipping a page with your fingers . If it's not adjacent , For example, I jump from the first page to the third page ,position First, 0, And then gradually become 1, And then gradually become 2; I jump from the third page to the first ,position First, 1, And then gradually become 0, It doesn't appear to be 2 The situation of .
positionOffset: Sliding scale of the current page , If you flip the page to the right , This value keeps growing , Finally, it's approaching 1 And then it mutates into 0. If the page flips to the left , This value keeps getting smaller , Finally, it becomes 0.
positionOffsetPixels: The current page slides pixels , Changes and positionOffset AgreementonPageSelected(int position)
position Is the index of the selected page , This method is called when the page is selected or the page slides a sufficient distance to switch to the page, and the finger is raised .
The execution order of the three methods : When you flip pages with your fingers , Do it first onPageScrollStateChanged(1), And then it goes on and on onPageScrolled, When I let go of my finger , Immediately onPageScrollStateChanged(2), And then do it immediately onPageSelected, And then continue to execute onPageScrollStateChanged, For the last time onPageScrollStateChanged(0).
The use of three adapters and their main methods are explained in detail
Three adapter inheritance relationships

PagerAdapter
The main methods are explained in detail
public abstract int getCount ()
Returns the number of valid views .public int getItemPosition (Object object)
Called when the host view attempts to determine whether the position of an item has changed . If the position of the given item has not changed, returnPOSITION_UNCHANGED, Returns... If the item no longer exists in the adapterPOSITION_NONE.
stay ViewPager.dataSetChanged() The return value of this function will be judged , If you returnPOSITION_NONECalldestroyItem(ViewGroup container, int position, Object object)Method to destroy the view , If you returnPOSITION_UNCHANGEDNo change will be made , If the data changes , The triggerPagerAdapter.instantiateItem(ViewGroup container, int position)Method to change the view .
PagerAdapter The default return value of this method in is POSITION_UNCHANGED. If the function is not overloaded , Which leads to the call PagerAdapter.notifyDataSetChanged() after , Nothing happened .public boolean isViewFromObject (View view, Object object)
Decide a page view Whether or notinstantiateItem(ViewGroup, int)Method returns the concrete key Object association .
viewpager Instead of dealing directly with each view, associate each view with a key . This key is used to track and uniquely represent a page , More Than This , The key is also independent of where the page is located adapter The location of . When pageradapter When he is about to change, he will callstartUpdatefunction , Next, one or moreinstantiateItemperhapsdestroyItem. Finally, it will be called later in the updatefinishUpdate. WhenfinishUpdatereturninstantiateItemThe returned object should be added to the parent ViewGroup,destroyItemThe returned object should be ViewGroup Delete .isViewFromObject(View, Object)Represents whether the current page is associated with a given key .
Customize Key Example - Simply place position Most of all key
-
private
class MyPagerAdapter extends PagerAdapter {
-
-
private List<View> mViewList;
-
-
MyPagerAdapter(List<View> viewList) {
-
mViewList = viewList;
-
}
-
-
@Override
-
public
int
getCount
() {
-
Log.i(TAG, NAME +
"--getCount");
-
return mViewList.size();
-
}
-
-
@Override
-
public
int
getItemPosition
(Object object) {
-
return
super.getItemPosition(object);
-
}
-
-
@Override
-
public
boolean
isViewFromObject
(View view, Object object) {
-
Log.i(TAG, NAME +
"--isViewFromObject");
-
return view == mViewList.get((
int)Integer.parseInt(object.toString()));
-
}
-
-
@Override
-
public
Object
instantiateItem
(ViewGroup container,
int
position) {
-
View view = mViewList.get(position);
-
container.addView(view);
-
Log.i(TAG, NAME +
"--instantiateItem++container:" + container.getChildCount() +
"++position:" + position);
-
return position;
-
}
-
-
@Override
-
public
void
destroyItem
(ViewGroup container,
int
position, Object object) {
-
container.removeView(mViewList.get(position));
-
Log.i(TAG, NAME +
"--destroyItem++container:" + container.getChildCount() +
"++position:" + position);
-
}
-
-
}
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
- 11
- 12
- 13
- 14
- 15
- 16
- 17
- 18
- 19
- 20
- 21
- 22
- 23
- 24
- 25
- 26
- 27
- 28
- 29
- 30
- 31
- 32
- 33
- 34
- 35
- 36
- 37
- 38
- 39
- 40
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
- 11
- 12
- 13
- 14
- 15
- 16
- 17
- 18
- 19
- 20
- 21
- 22
- 23
- 24
- 25
- 26
- 27
- 28
- 29
- 30
- 31
- 32
- 33
- 34
- 35
- 36
- 37
- 38
- 39
- 40
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
- 11
- 12
- 13
- 14
- 15
- 16
- 17
- 18
- 19
- 20
- 21
- 22
- 23
- 24
- 25
- 26
- 27
- 28
- 29
- 30
- 31
- 32
- 33
- 34
- 35
- 36
- 37
- 38
- 39
- 40
public Object instantiateItem (ViewGroup container, int position)
Create a page view at the specified location . It is the responsibility of the adapter to add to the View View to a given container in , Make sure that the finishUpdate(viewGroup) return , The addition of views has been completed .
The return value of this method is the value of the new view page Object(Key), There is no need to return to the view itself , It can also be other containers of this page , It can return any value associated with the view .public void destroyItem (ViewGroup container, int position, Object object)
Remove... From a given location view, It is the responsibility of the adapter to view from container Remove , Make sure that the finishUpdate(viewGroup) return , The removal of the view is complete .public void startUpdate (ViewGroup container)
Call... When a change is about to occur in the displayed interface .public void finishUpdate (ViewGroup container)
Call... When the change in the display interface is completed . At this point in time , You must make sure that all pages have been properly selected from container Add or remove .public void notifyDataSetChanged ()
This method is actively called by the application when the adapter data changes .public void registerDataSetObserver (DataSetObserver observer)
Register an observer to receive callbacks associated with changes in adapter data .public void unregisterDataSetObserver (DataSetObserver observer)
Unregister observers to receive callbacks associated with adapter data changes .public void setPrimaryItem (ViewGroup container, int position, Object object)
Call this method to inform the current adapter which item is considered “primary”, It is the page currently displayed to the user .public CharSequence getPageTitle (int position)
The method by ViewPager When getting the title of the description page, call . This method returns... By default null.public float getPageWidth (int position)
This method returns the proportional width of a given page , Range (0.f-1.f].public Parcelable saveState ()
Save the instance state associated with the adapter , When the present UI Restore when state needs to be rebuilt .public void restoreState (Parcelable state, ClassLoader loader)
Before recovery bysaveState ()Saved instance state associated with the adapter .
PagerAdapter Examples of use
activity_pager_adapter.xml file
-
<?xml version="1.0" encoding="utf-8"?>
-
<RelativeLayout 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:context
=
"com.example.sunxiaodong.viewpager.PagerAdapterActivity"
>
-
-
<android.support.v4.view.ViewPager
-
android:id
=
"@+id/viewpager"
-
android:layout_width
=
"match_parent"
-
android:layout_height
=
"match_parent"
>
-
-
</android.support.v4.view.ViewPager>
-
-
<TextView
-
android:id
=
"@+id/page_num"
-
android:layout_width
=
"wrap_content"
-
android:layout_height
=
"wrap_content"
-
android:layout_alignParentBottom
=
"true"
-
android:layout_alignParentLeft
=
"true"
-
android:textColor
=
"#ffffff"
-
android:textSize
=
"20sp"
/>
-
-
<LinearLayout
-
android:layout_width
=
"wrap_content"
-
android:layout_height
=
"wrap_content"
-
android:layout_centerHorizontal
=
"true"
>
-
-
<EditText
-
android:id
=
"@+id/edit_text"
-
android:layout_width
=
"100dp"
-
android:layout_height
=
"50dp"
-
android:layout_gravity
=
"center_vertical"
-
android:textColor
=
"#000000"
-
android:textSize
=
"20sp"
/>
-
-
<Button
-
android:id
=
"@+id/button"
-
android:layout_width
=
"80dp"
-
android:layout_height
=
"40dp"
-
android:layout_gravity
=
"center_vertical"
-
android:layout_marginLeft
=
"10dp"
-
android:text
=
" Jump "
-
android:textColor
=
"#ffffff"
/>
-
</LinearLayout>
-
-
</RelativeLayout>
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
- 11
- 12
- 13
- 14
- 15
- 16
- 17
- 18
- 19
- 20
- 21
- 22
- 23
- 24
- 25
- 26
- 27
- 28
- 29
- 30
- 31
- 32
- 33
- 34
- 35
- 36
- 37
- 38
- 39
- 40
- 41
- 42
- 43
- 44
- 45
- 46
- 47
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
- 11
- 12
- 13
- 14
- 15
- 16
- 17
- 18
- 19
- 20
- 21
- 22
- 23
- 24
- 25
- 26
- 27
- 28
- 29
- 30
- 31
- 32
- 33
- 34
- 35
- 36
- 37
- 38
- 39
- 40
- 41
- 42
- 43
- 44
- 45
- 46
- 47
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
- 11
- 12
- 13
- 14
- 15
- 16
- 17
- 18
- 19
- 20
- 21
- 22
- 23
- 24
- 25
- 26
- 27
- 28
- 29
- 30
- 31
- 32
- 33
- 34
- 35
- 36
- 37
- 38
- 39
- 40
- 41
- 42
- 43
- 44
- 45
- 46
- 47
page1.xml file
-
<?xml version="1.0" encoding="utf-8"?>
-
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
-
android:layout_width
=
"match_parent"
-
android:layout_height
=
"match_parent"
-
android:background
=
"#ff0000"
>
-
-
<TextView
-
android:layout_width
=
"wrap_content"
-
android:layout_height
=
"wrap_content"
-
android:layout_centerInParent
=
"true"
-
android:text
=
"page1"
-
android:textColor
=
"#ffffff"
-
android:textSize
=
"20sp"
/>
-
-
</RelativeLayout>
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
- 11
- 12
- 13
- 14
- 15
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
- 11
- 12
- 13
- 14
- 15
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
- 11
- 12
- 13
- 14
- 15
page2.xml file
-
<?xml version="1.0" encoding="utf-8"?>
-
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
-
android:layout_width
=
"match_parent"
-
android:layout_height
=
"match_parent"
-
android:background
=
"#ff00ff"
>
-
-
<TextView
-
android:layout_width
=
"wrap_content"
-
android:layout_height
=
"wrap_content"
-
android:layout_centerInParent
=
"true"
-
android:text
=
"page2"
-
android:textColor
=
"#ffffff"
-
android:textSize
=
"20sp"
/>
-
-
</RelativeLayout>
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
- 11
- 12
- 13
- 14
- 15
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
- 11
- 12
- 13
- 14
- 15
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
- 11
- 12
- 13
- 14
- 15
page3.xml file
-
<?xml version="1.0" encoding="utf-8"?>
-
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
-
android:layout_width
=
"match_parent"
-
android:layout_height
=
"match_parent"
-
android:background
=
"#00ff00"
>
-
-
<TextView
-
android:layout_width
=
"wrap_content"
-
android:layout_height
=
"wrap_content"
-
android:layout_centerInParent
=
"true"
-
android:text
=
"page3"
-
android:textColor
=
"#ffffff"
-
android:textSize
=
"20sp"
/>
-
-
</RelativeLayout>
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
- 11
- 12
- 13
- 14
- 15
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
- 11
- 12
- 13
- 14
- 15
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
- 11
- 12
- 13
- 14
- 15
page4.xml file
-
<?xml version="1.0" encoding="utf-8"?>
-
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
-
android:layout_width
=
"match_parent"
-
android:layout_height
=
"match_parent"
-
android:background
=
"#ffff00"
>
-
-
<TextView
-
android:layout_width
=
"wrap_content"
-
android:layout_height
=
"wrap_content"
-
android:layout_centerInParent
=
"true"
-
android:text
=
"page4"
-
android:textColor
=
"#ffffff"
-
android:textSize
=
"20sp"
/>
-
-
</RelativeLayout>
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
- 11
- 12
- 13
- 14
- 15
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
- 11
- 12
- 13
- 14
- 15
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
- 11
- 12
- 13
- 14
- 15
page5.xml file
-
<?xml version="1.0" encoding="utf-8"?>
-
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
-
android:layout_width
=
"match_parent"
-
android:layout_height
=
"match_parent"
-
android:background
=
"#8e35ef"
>
-
-
<TextView
-
android:layout_width
=
"wrap_content"
-
android:layout_height
=
"wrap_content"
-
android:layout_centerInParent
=
"true"
-
android:text
=
"page5"
-
android:textColor
=
"#ffffff"
-
android:textSize
=
"20sp"
/>
-
-
</RelativeLayout>
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
- 11
- 12
- 13
- 14
- 15
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
- 11
- 12
- 13
- 14
- 15
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
- 11
- 12
- 13
- 14
- 15
PagerAdapterActivity.Java file
-
public
class PagerAdapterActivity extends AppCompatActivity implements View.OnClickListener {
-
-
private
static
final String NAME = PagerAdapterActivity.class.getSimpleName();
-
private
static
final String TAG =
"sxd";
-
-
private ViewPager mViewPager;
-
private MyPagerAdapter mMyPagerAdapter;
-
private TextView mPageNum;
-
private EditText mEditText;
-
private Button mButton;
-
-
@Override
-
protected
void
onCreate
(Bundle savedInstanceState) {
-
super.onCreate(savedInstanceState);
-
setContentView(R.layout.activity_pager_adapter);
-
initView();
-
}
-
-
private
void
initView
() {
-
mViewPager = (ViewPager)
this.findViewById(R.id.viewpager);
-
mPageNum = (TextView)
this.findViewById(R.id.page_num);
-
mEditText = (EditText)
this.findViewById(R.id.edit_text);
-
mButton = (Button)
this.findViewById(R.id.button);
-
mButton.setOnClickListener(
this);
-
-
List<View> viewList =
new ArrayList<View>();
-
-
LayoutInflater layoutInflater = getLayoutInflater();
-
View view1 = layoutInflater.inflate(R.layout.page1,
null);
-
View view2 = layoutInflater.inflate(R.layout.page2,
null);
-
View view3 = layoutInflater.inflate(R.layout.page3,
null);
-
View view4 = layoutInflater.inflate(R.layout.page4,
null);
-
View view5 = layoutInflater.inflate(R.layout.page5,
null);
-
-
viewList.add(view1);
-
viewList.add(view2);
-
viewList.add(view3);
-
viewList.add(view4);
-
viewList.add(view5);
-
mMyPagerAdapter =
new MyPagerAdapter(viewList);
-
mViewPager.setAdapter(mMyPagerAdapter);
-
mViewPager.addOnPageChangeListener(
new OnMyPageChangeListener());
// Page change monitoring
-
mViewPager.setOffscreenPageLimit(
2);
// Set the number of cached pages . The current page , Left and right ( unilateral ) Maximum number of cached pages .
-
// mViewPager.setOnScrollChangeListener(new OnMyScrollChangeListener());// Rolling state monitoring ,minSdkVersion:23
-
// mViewPager.getCurrentItem();// Gets the index of the currently displayed page
-
// mViewPager.getOffscreenPageLimit();// Get the number of cached pages
-
// mViewPager.onSaveInstanceState();
-
// mViewPager.setPageTransformer();
-
mMyPagerAdapter.notifyDataSetChanged();
-
setPageNum(
0);
// Set the display home page
-
}
-
-
@Override
-
public
void
onClick
(View v) {
-
switch (v.getId()) {
-
case R.id.button:
-
goPage();
-
break;
-
}
-
}
-
-
private
void
goPage
() {
-
String pageNumStr = mEditText.getText().toString();
-
if (pageNumStr ==
null || pageNumStr.isEmpty()) {
-
return;
-
}
-
int pageNum = Integer.parseInt(pageNumStr);
-
if (pageNum >
0 && pageNum <= mMyPagerAdapter.getCount()) {
-
mViewPager.setCurrentItem(pageNum -
1);
// Sets the index of the currently displayed page
-
}
-
}
-
-
private
void
setPageNum
(
int
position) {
-
String pageNum = (position +
1) +
"/" + mMyPagerAdapter.getCount();
-
mPageNum.setText(pageNum);
-
}
-
-
/*private class OnMyScrollChangeListener implements View.OnScrollChangeListener {
-
-
@Override
-
public void onScrollChange(View v, int scrollX, int scrollY, int oldScrollX, int oldScrollY) {
-
-
}
-
}*/
-
-
/**
-
* Page change listener
-
*/
-
private
class OnMyPageChangeListener implements ViewPager.OnPageChangeListener {
-
-
@Override
-
public
void
onPageScrolled
(
int
position,
float
positionOffset,
int
positionOffsetPixels) {
-
Log.i(TAG, NAME +
"--onPageScrolled++position:" + position +
",++positionOffset:" + positionOffset +
",++positionOffsetPixels:" + positionOffsetPixels);
-
}
-
-
@Override
-
public
void
onPageSelected
(
int
position) {
-
Log.i(TAG, NAME +
"--onPageSelected++position:" + position);
-
setPageNum(position);
-
}
-
-
@Override
-
public
void
onPageScrollStateChanged
(
int
state) {
-
Log.i(TAG, NAME +
"--onPageScrollStateChanged++state:" + state);
-
}
-
}
-
-
/**
-
* Page adapter
-
*/
-
private
class MyPagerAdapter extends PagerAdapter {
-
-
private List<View> mViewList;
-
-
MyPagerAdapter(List<View> viewList) {
-
mViewList = viewList;
-
}
-
-
@Override
-
public
int
getCount
() {
-
Log.i(TAG, NAME +
"--getCount");
-
return mViewList.size();
-
}
-
-
@Override
-
public
int
getItemPosition
(Object object) {
-
Log.i(TAG, NAME +
"--getItemPosition");
-
return
super.getItemPosition(object);
-
}
-
-
@Override
-
public
boolean
isViewFromObject
(View view, Object object) {
-
Log.i(TAG, NAME +
"--isViewFromObject");
-
return view == object;
-
}
-
-
@Override
-
public
Object
instantiateItem
(ViewGroup container,
int
position) {
-
View view = mViewList.get(position);
-
container.addView(view);
-
Log.i(TAG, NAME +
"--instantiateItem++container:" + container.getChildCount() +
"++position:" + position);
-
return view;
-
}
-
-
@Override
-
public
void
destroyItem
(ViewGroup container,
int
position, Object object) {
-
container.removeView(mViewList.get(position));
-
Log.i(TAG, NAME +
"--destroyItem++container:" + container.getChildCount() +
"++position:" + position);
-
}
-
-
}
-
-
}
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
- 11
- 12
- 13
- 14
- 15
- 16
- 17
- 18
- 19
- 20
- 21
- 22
- 23
- 24
- 25
- 26
- 27
- 28
- 29
- 30
- 31
- 32
- 33
- 34
- 35
- 36
- 37
- 38
- 39
- 40
- 41
- 42
- 43
- 44
- 45
- 46
- 47
- 48
- 49
- 50
- 51
- 52
- 53
- 54
- 55
- 56
- 57
- 58
- 59
- 60
- 61
- 62
- 63
- 64
- 65
- 66
- 67
- 68
- 69
- 70
- 71
- 72
- 73
- 74
- 75
- 76
- 77
- 78
- 79
- 80
- 81
- 82
- 83
- 84
- 85
- 86
- 87
- 88
- 89
- 90
- 91
- 92
- 93
- 94
- 95
- 96
- 97
- 98
- 99
- 100
- 101
- 102
- 103
- 104
- 105
- 106
- 107
- 108
- 109
- 110
- 111
- 112
- 113
- 114
- 115
- 116
- 117
- 118
- 119
- 120
- 121
- 122
- 123
- 124
- 125
- 126
- 127
- 128
- 129
- 130
- 131
- 132
- 133
- 134
- 135
- 136
- 137
- 138
- 139
- 140
- 141
- 142
- 143
- 144
- 145
- 146
- 147
- 148
- 149
- 150
- 151
- 152
- 153
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
- 11
- 12
- 13
- 14
- 15
- 16
- 17
- 18
- 19
- 20
- 21
- 22
- 23
- 24
- 25
- 26
- 27
- 28
- 29
- 30
- 31
- 32
- 33
- 34
- 35
- 36
- 37
- 38
- 39
- 40
- 41
- 42
- 43
- 44
- 45
- 46
- 47
- 48
- 49
- 50
- 51
- 52
- 53
- 54
- 55
- 56
- 57
- 58
- 59
- 60
- 61
- 62
- 63
- 64
- 65
- 66
- 67
- 68
- 69
- 70
- 71
- 72
- 73
- 74
- 75
- 76
- 77
- 78
- 79
- 80
- 81
- 82
- 83
- 84
- 85
- 86
- 87
- 88
- 89
- 90
- 91
- 92
- 93
- 94
- 95
- 96
- 97
- 98
- 99
- 100
- 101
- 102
- 103
- 104
- 105
- 106
- 107
- 108
- 109
- 110
- 111
- 112
- 113
- 114
- 115
- 116
- 117
- 118
- 119
- 120
- 121
- 122
- 123
- 124
- 125
- 126
- 127
- 128
- 129
- 130
- 131
- 132
- 133
- 134
- 135
- 136
- 137
- 138
- 139
- 140
- 141
- 142
- 143
- 144
- 145
- 146
- 147
- 148
- 149
- 150
- 151
- 152
- 153
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
- 11
- 12
- 13
- 14
- 15
- 16
- 17
- 18
- 19
- 20
- 21
- 22
- 23
- 24
- 25
- 26
- 27
- 28
- 29
- 30
- 31
- 32
- 33
- 34
- 35
- 36
- 37
- 38
- 39
- 40
- 41
- 42
- 43
- 44
- 45
- 46
- 47
- 48
- 49
- 50
- 51
- 52
- 53
- 54
- 55
- 56
- 57
- 58
- 59
- 60
- 61
- 62
- 63
- 64
- 65
- 66
- 67
- 68
- 69
- 70
- 71
- 72
- 73
- 74
- 75
- 76
- 77
- 78
- 79
- 80
- 81
- 82
- 83
- 84
- 85
- 86
- 87
- 88
- 89
- 90
- 91
- 92
- 93
- 94
- 95
- 96
- 97
- 98
- 99
- 100
- 101
- 102
- 103
- 104
- 105
- 106
- 107
- 108
- 109
- 110
- 111
- 112
- 113
- 114
- 115
- 116
- 117
- 118
- 119
- 120
- 121
- 122
- 123
- 124
- 125
- 126
- 127
- 128
- 129
- 130
- 131
- 132
- 133
- 134
- 135
- 136
- 137
- 138
- 139
- 140
- 141
- 142
- 143
- 144
- 145
- 146
- 147
- 148
- 149
- 150
- 151
- 152
- 153
FragmentPagerAdapter
This adapter is best used for a limited number of static applications fragment Page management . Although invisible views are sometimes destroyed , But all the users have visited fragment Will be saved in memory . therefore fragment The instance will save a large number of various states , This creates a lot of memory overhead .
Use this adapter ,ViewPager It's going on Fragment When the interface is switched , The interface that exceeds the number of caches will be destroyed , But don't destroy the data , That is to call Fragment Of onDestoryView Method , All created Fragment Will be preserved .
The main methods are explained in detail
public abstract Fragment getItem (int position)
return position Location related Fragment.
FragmentPagerAdapter All generated Fragment Object passing FragmentManager Keep it for later use , I need this... In the future Fragment when , Will come from FragmentManager Read , Without calling... Again getItem() Method . This method can only be used when creating a new Fragment Call when .
When needed , This function will be instantiateItem() The call .
If required Fragment When an object passes relatively static data , We usually pass Fragment.setArguments() To carry out , This part of the code should be placed in getItem(). They will only be generated in the new Fragment Object .public long getItemId (int position)
The unique identifier returned to the locator .public Object instantiateItem (ViewGroup container, int position)
This method generates data outside the cache page every time Fragment It will call , there Fragment It could be a new build , It could also be recovery .
Function to determine the... To be generated Fragment Have you generated , If I've generated it , Just use the old , The old will beFragment.attach(); without , Just callgetItem()Make a new one , The new object will beFragmentTransation.add().
FragmentPagerAdapter All generated Fragment Object passing FragmentManager Keep it for later use , I need this... In the future Fragment when , Will come from FragmentManager Read , Without calling... AgaingetItem()Method .
If necessary, generate Fragment After the object , Pass some data in the dataset to the Fragment, This part of the code should be placed in the overload of this function . In the subclasses we inherit , Overload the function , And callFragmentPagerAdapter.instantiateItem()Gets the return of the function Fragment object , then , We should Fragment Object , Pass the data through , Then return the object .
otherwise , If you put this part of the code that passes data intogetItem()in , stayPagerAdapter.notifyDataSetChanged()after , This part of the data setting code will not be called .public void destroyItem(ViewGroup container, int position, Object object)
Pages out of cache , This method will be called to remove from the view .
After the function is called , Would be right Fragment ConductFragmentTransaction.detach(). It's not hereremove(), It's justdetach(), therefore Fragment still FragmentManager The management of ,Fragment The resources occupied will not be released .
FragmentPagerAdapter Examples of use
FragmentPagerAdapterActivity.java file
-
/**
-
* Created by sunxiaodong on 16/1/27.
-
* This adapter is best used for a limited number of static applications fragment Page management . Although invisible views are sometimes destroyed , But all the users have visited fragment Will be saved in memory . therefore fragment The instance will save a large number of various states , This creates a lot of memory overhead .
-
* So if you have to deal with a lot of page switching , It is recommended to use FragmentStatePagerAdapter.
-
*/
-
public
class FragmentPagerAdapterActivity extends AppCompatActivity implements View.OnClickListener {
-
-
private
static
final String NAME = FragmentPagerAdapterActivity.class.getSimpleName();
-
private
static
final String TAG =
"sxd";
-
-
private ViewPager mViewPager;
-
private MyFragmentPagerAdapter mMyFragmentPagerAdapter;
-
private TextView mPageNum;
-
private EditText mEditText;
-
private Button mButton;
-
-
@Override
-
protected
void
onCreate
(Bundle savedInstanceState) {
-
super.onCreate(savedInstanceState);
-
setContentView(R.layout.activity_pager_adapter);
-
initView();
-
}
-
-
private
void
initView
() {
-
mViewPager = (ViewPager)
this.findViewById(R.id.viewpager);
-
mPageNum = (TextView)
this.findViewById(R.id.page_num);
-
mEditText = (EditText)
this.findViewById(R.id.edit_text);
-
mButton = (Button)
this.findViewById(R.id.button);
-
mButton.setOnClickListener(
this);
-
-
List<Fragment> fragments =
new ArrayList<Fragment>();
-
Fragment fragment1 = MyFragment.newInstance(
1);
-
Fragment fragment2 = MyFragment.newInstance(
2);
-
Fragment fragment3 = MyFragment.newInstance(
3);
-
Fragment fragment4 = MyFragment.newInstance(
4);
-
Fragment fragment5 = MyFragment.newInstance(
5);
-
-
-
fragments.add(fragment1);
-
fragments.add(fragment2);
-
fragments.add(fragment3);
-
fragments.add(fragment4);
-
fragments.add(fragment5);
-
-
mMyFragmentPagerAdapter =
new MyFragmentPagerAdapter(getSupportFragmentManager(), fragments);
-
mViewPager.setAdapter(mMyFragmentPagerAdapter);
-
mViewPager.addOnPageChangeListener(
new OnMyPageChangeListener());
// Page change monitoring
-
mViewPager.setOffscreenPageLimit(
2);
// Set the number of cached pages . The current page , Left and right ( unilateral ) Maximum number of cached pages .
-
// mViewPager.setOnScrollChangeListener(new OnMyScrollChangeListener());// Rolling state monitoring ,minSdkVersion:23
-
// mViewPager.getCurrentItem();// Gets the index of the currently displayed page
-
// mViewPager.getOffscreenPageLimit();// Get the number of cached pages
-
// mViewPager.onSaveInstanceState();
-
// mViewPager.setPageTransformer();
-
setPageNum(
0);
// Set the display home page
-
}
-
-
@Override
-
public
void
onClick
(View v) {
-
switch (v.getId()) {
-
case R.id.button:
-
goPage();
-
break;
-
}
-
}
-
-
private
void
goPage
() {
-
String pageNumStr = mEditText.getText().toString();
-
if (pageNumStr ==
null || pageNumStr.isEmpty()) {
-
return;
-
}
-
int pageNum = Integer.parseInt(pageNumStr);
-
if (pageNum >
0 && pageNum <= mMyFragmentPagerAdapter.getCount()) {
-
mViewPager.setCurrentItem(pageNum -
1);
// Sets the index of the currently displayed page
-
}
-
}
-
-
private
void
setPageNum
(
int
position) {
-
String pageNum = (position +
1) +
"/" + mMyFragmentPagerAdapter.getCount();
-
mPageNum.setText(pageNum);
-
}
-
-
/**
-
* Page change listener .
-
* The order of execution of the three methods is : When you flip pages with your fingers , Do it first onPageScrollStateChanged(1), And then it goes on and on onPageScrolled, When I let go of my finger , Immediately onPageScrollStateChanged(2), And then do it immediately onPageSelected, And then continue to execute onPageScrollStateChanged, For the last time onPageScrollStateChanged(0).
-
*/
-
private
class OnMyPageChangeListener implements ViewPager.OnPageChangeListener {
-
-
@Override
-
public
void
onPageScrolled
(
int
position,
float
positionOffset,
int
positionOffsetPixels) {
-
//position: When you slide with your fingers , If you hold your finger on the page ,position And the current page index It's consistent ; If you drag your finger to the left ( The corresponding page turns to the right ), Now position Most of the time, it is consistent with the current page , Only when page flipping is successful, the last call will become the target page ; If you drag your finger to the right ( Flip the corresponding page to the left ), Now position Most of the time, it's consistent with the target page , Only in the case of unsuccessful page turning, the last call will become the original page .
-
// When setting directly setCurrentItem When turning pages , If it's adjacent ( For example, now is the second page , Jump to the first or third page ), If you flip the page to the right , Most of the time is consistent with the current page , Only in the end will it become the target page ; If you flip to the left ,position Consistent with the target page . This is basically the same as flipping a page with your fingers .
-
// If it's not adjacent , For example, I jump from the first page to the third page ,position First, 0, And then gradually become 1, And then gradually become 2; I jump from the third page to the first ,position First, 1, And then gradually become 0, It doesn't appear to be 2 The situation of .
-
//positionOffset: Sliding scale of the current page , If you flip the page to the right , This value keeps growing , Finally, it's approaching 1 And then it mutates into 0. If the page flips to the left , This value keeps getting smaller , Finally, it becomes 0.
-
//positionOffsetPixels: The current page slides pixels , Changes and positionOffset Agreement .
-
Log.i(TAG, NAME +
"--onPageScrolled++position:" + position +
",++positionOffset:" + positionOffset +
",++positionOffsetPixels:" + positionOffsetPixels);
-
}
-
-
@Override
-
public
void
onPageSelected
(
int
position) {
-
//position Is the index of the selected page , This method is called when the page is selected or the page slides a sufficient distance to switch to the page, and the finger is raised .
-
Log.i(TAG, NAME +
"--onPageSelected++position:" + position);
-
setPageNum(position);
-
}
-
-
@Override
-
public
void
onPageScrollStateChanged
(
int
state) {
-
// This method changes when the finger operates the screen . There are three values :0(END),1(PRESS) , 2(UP) .
-
// When you flip pages with your fingers , This method is triggered when the finger is pressed down ,state The value is 1, When the fingers are raised ,
-
// If there's a slip ( Even if it's small ), This value will change to 2, And then it turns out to be 0 . Three times in total .
-
// One special case is that the finger does not slide at all after it is pressed down , This method will only be called twice at this time ,state Values are respectively 1,0 .
-
// When setCurrentItem When turning pages , This method will be executed twice ,state Values, respectively 2 , 0 .
-
Log.i(TAG, NAME +
"--onPageScrollStateChanged++state:" + state);
-
}
-
}
-
-
/**
-
* Fragment Page adapter
-
* ViewPager It's going on Fragment When the interface is switched , The interface that exceeds the number of caches will be destroyed , But don't destroy the data , That is to call Fragment Of onDestoryView Method
-
* All created Fragment Will be preserved
-
*/
-
private
class MyFragmentPagerAdapter extends FragmentPagerAdapter {
-
-
private List<Fragment> mFragments;
-
-
MyFragmentPagerAdapter(FragmentManager fm, List<Fragment> fragments) {
-
super(fm);
-
mFragments = fragments;
-
}
-
-
@Override
-
public
Fragment
getItem
(
int
position) {
-
//FragmentPagerAdapter All generated Fragment Object passing FragmentManager Keep it for later use , I need this... In the future Fragment when ,
-
// Will come from FragmentManager Read , Without calling... Again getItem() Method . This method can only be used when creating a new Fragment Call when .
-
//1. When needed , This function will be instantiateItem() The call .
-
//2. If required Fragment When an object passes relatively static data , We usually pass Fragment.setArguments() To carry out , This part of the code should be placed in getItem(). They will only be generated in the new Fragment Object .
-
Log.i(TAG, NAME +
"--getItem++position:" + position);
-
return mFragments.get(position);
-
}
-
-
@Override
-
public
Object
instantiateItem
(ViewGroup container,
int
position) {
-
// This method generates data outside the cache page every time Fragment It will call , there Fragment It could be a new build , It could also be recovery
-
//1. Function to determine the... To be generated Fragment Have you generated , If I've generated it , Just use the old , The old will be Fragment.attach(); without , Just call getItem() Make a new one , The new object will be FragmentTransation.add().
-
//2. FragmentPagerAdapter All generated Fragment Object passing FragmentManager Keep it for later use , I need this... In the future Fragment when , Will come from FragmentManager Read , Without calling... Again getItem() Method .
-
//3. If necessary, generate Fragment After the object , Pass some data in the dataset to the Fragment, This part of the code should be placed in the overload of this function . In the subclasses we inherit , Overload the function , And call FragmentPagerAdapter.instantiateItem() Gets the return of the function Fragment object , then , We should Fragment Object , Pass the data through , Then return the object .
-
// otherwise , If you put this part of the code that passes data into getItem() in , stay PagerAdapter.notifyDataSetChanged() after , This part of the data setting code will not be called .
-
Log.i(TAG, NAME +
"--instantiateItem++container:" + container.getChildCount() +
"++position:" + position);
-
return
super.instantiateItem(container, position);
-
}
-
-
@Override
-
public
void
destroyItem
(ViewGroup container,
int
position, Object object) {
-
// Pages out of cache , This method will be called to remove from the view
-
// After the function is called , Would be right Fragment Conduct FragmentTransaction.detach(). It's not here remove(), It's just detach(), therefore Fragment still FragmentManager The management of ,Fragment The resources occupied will not be released .
-
Log.i(TAG, NAME +
"--destroyItem++container:" + container.getChildCount() +
"++position:" + position);
-
super.destroyItem(container, position, object);
-
}
-
-
@Override
-
public
int
getCount
() {
-
Log.i(TAG, NAME +
"--getCount++");
-
return mFragments.size();
-
}
-
}
-
-
}
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
- 11
- 12
- 13
- 14
- 15
- 16
- 17
- 18
- 19
- 20
- 21
- 22
- 23
- 24
- 25
- 26
- 27
- 28
- 29
- 30
- 31
- 32
- 33
- 34
- 35
- 36
- 37
- 38
- 39
- 40
- 41
- 42
- 43
- 44
- 45
- 46
- 47
- 48
- 49
- 50
- 51
- 52
- 53
- 54
- 55
- 56
- 57
- 58
- 59
- 60
- 61
- 62
- 63
- 64
- 65
- 66
- 67
- 68
- 69
- 70
- 71
- 72
- 73
- 74
- 75
- 76
- 77
- 78
- 79
- 80
- 81
- 82
- 83
- 84
- 85
- 86
- 87
- 88
- 89
- 90
- 91
- 92
- 93
- 94
- 95
- 96
- 97
- 98
- 99
- 100
- 101
- 102
- 103
- 104
- 105
- 106
- 107
- 108
- 109
- 110
- 111
- 112
- 113
- 114
- 115
- 116
- 117
- 118
- 119
- 120
- 121
- 122
- 123
- 124
- 125
- 126
- 127
- 128
- 129
- 130
- 131
- 132
- 133
- 134
- 135
- 136
- 137
- 138
- 139
- 140
- 141
- 142
- 143
- 144
- 145
- 146
- 147
- 148
- 149
- 150
- 151
- 152
- 153
- 154
- 155
- 156
- 157
- 158
- 159
- 160
- 161
- 162
- 163
- 164
- 165
- 166
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
- 11
- 12
- 13
- 14
- 15
- 16
- 17
- 18
- 19
- 20
- 21
- 22
- 23
- 24
- 25
- 26
- 27
- 28
- 29
- 30
- 31
- 32
- 33
- 34
- 35
- 36
- 37
- 38
- 39
- 40
- 41
- 42
- 43
- 44
- 45
- 46
- 47
- 48
- 49
- 50
- 51
- 52
- 53
- 54
- 55
- 56
- 57
- 58
- 59
- 60
- 61
- 62
- 63
- 64
- 65
- 66
- 67
- 68
- 69
- 70
- 71
- 72
- 73
- 74
- 75
- 76
- 77
- 78
- 79
- 80
- 81
- 82
- 83
- 84
- 85
- 86
- 87
- 88
- 89
- 90
- 91
- 92
- 93
- 94
- 95
- 96
- 97
- 98
- 99
- 100
- 101
- 102
- 103
- 104
- 105
- 106
- 107
- 108
- 109
- 110
- 111
- 112
- 113
- 114
- 115
- 116
- 117
- 118
- 119
- 120
- 121
- 122
- 123
- 124
- 125
- 126
- 127
- 128
- 129
- 130
- 131
- 132
- 133
- 134
- 135
- 136
- 137
- 138
- 139
- 140
- 141
- 142
- 143
- 144
- 145
- 146
- 147
- 148
- 149
- 150
- 151
- 152
- 153
- 154
- 155
- 156
- 157
- 158
- 159
- 160
- 161
- 162
- 163
- 164
- 165
- 166
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
- 11
- 12
- 13
- 14
- 15
- 16
- 17
- 18
- 19
- 20
- 21
- 22
- 23
- 24
- 25
- 26
- 27
- 28
- 29
- 30
- 31
- 32
- 33
- 34
- 35
- 36
- 37
- 38
- 39
- 40
- 41
- 42
- 43
- 44
- 45
- 46
- 47
- 48
- 49
- 50
- 51
- 52
- 53
- 54
- 55
- 56
- 57
- 58
- 59
- 60
- 61
- 62
- 63
- 64
- 65
- 66
- 67
- 68
- 69
- 70
- 71
- 72
- 73
- 74
- 75
- 76
- 77
- 78
- 79
- 80
- 81
- 82
- 83
- 84
- 85
- 86
- 87
- 88
- 89
- 90
- 91
- 92
- 93
- 94
- 95
- 96
- 97
- 98
- 99
- 100
- 101
- 102
- 103
- 104
- 105
- 106
- 107
- 108
- 109
- 110
- 111
- 112
- 113
- 114
- 115
- 116
- 117
- 118
- 119
- 120
- 121
- 122
- 123
- 124
- 125
- 126
- 127
- 128
- 129
- 130
- 131
- 132
- 133
- 134
- 135
- 136
- 137
- 138
- 139
- 140
- 141
- 142
- 143
- 144
- 145
- 146
- 147
- 148
- 149
- 150
- 151
- 152
- 153
- 154
- 155
- 156
- 157
- 158
- 159
- 160
- 161
- 162
- 163
- 164
- 165
- 166
FragmentStatePagerAdapter
The adapter is suitable for handling a large number of page switching , It can save and restore Fragment Status adapter , Cache exceeded Fragment Would call onDestory() Method , Completely destroy Fragment To destroy .
The main methods are explained in detail
public Fragment getItem(int position)
return position Location related Fragment.
This method slides to the cached page , Not called . Pages that have been created and destroyed outside the cache , This method will be called again , Recreate .public Object instantiateItem(ViewGroup container, int position)
Unless you run into it FragmentManager Just from SavedState The corresponding Fragment In case of ( Recover from page cache ), This function will callgetItem()function , Generate a new Fragment object . The new object will beFragmentTransaction.add().public void destroyItem(ViewGroup container, int position, Object object)
Pages out of cache , This method will be called to remove from the view .
FragmentStatePagerAdapter Examples of use
-
/**
-
* Can save and restore Fragment Status adapter
-
* Cache exceeded Fragment Would call onDestory() Method , Completely destroy Fragment To destroy
-
*/
-
class MyFragmentStatePagerAdapter extends FragmentStatePagerAdapter {
-
-
private List<Fragment> mFragments;
-
-
MyFragmentStatePagerAdapter(FragmentManager fm, List<Fragment> fragments) {
-
super(fm);
-
mFragments = fragments;
-
}
-
-
@Override
-
public
Fragment
getItem
(
int
position) {
-
// This method slides to the cached page , Not called . Pages that have been created and destroyed outside the cache , This method will be called again , Recreate .
-
Log.i(TAG, NAME +
"--getItem++position:" + position);
-
return mFragments.get(position);
-
}
-
-
@Override
-
public
Object
instantiateItem
(ViewGroup container,
int
position) {
-
// Unless you run into it FragmentManager Just from SavedState The corresponding Fragment In case of ( Recover from page cache ), This function will call getItem() function , Generate a new Fragment object . The new object will be FragmentTransaction.add().
-
Log.i(TAG, NAME +
"--instantiateItem++container:" + container.getChildCount() +
"++position:" + position);
-
return
super.instantiateItem(container, position);
-
}
-
-
@Override
-
public
void
destroyItem
(ViewGroup container,
int
position, Object object) {
-
// Pages out of cache , This method will be called to remove from the view
-
Log.i(TAG, NAME +
"--destroyItem++container:" + container.getChildCount() +
"++position:" + position);
-
super.destroyItem(container, position, object);
-
}
-
-
@Override
-
public
int
getCount
() {
-
Log.i(TAG, NAME +
"--getCount++");
-
return mFragments.size();
-
}
-
}
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
- 11
- 12
- 13
- 14
- 15
- 16
- 17
- 18
- 19
- 20
- 21
- 22
- 23
- 24
- 25
- 26
- 27
- 28
- 29
- 30
- 31
- 32
- 33
- 34
- 35
- 36
- 37
- 38
- 39
- 40
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
- 11
- 12
- 13
- 14
- 15
- 16
- 17
- 18
- 19
- 20
- 21
- 22
- 23
- 24
- 25
- 26
- 27
- 28
- 29
- 30
- 31
- 32
- 33
- 34
- 35
- 36
- 37
- 38
- 39
- 40
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
- 11
- 12
- 13
- 14
- 15
- 16
- 17
- 18
- 19
- 20
- 21
- 22
- 23
- 24
- 25
- 26
- 27
- 28
- 29
- 30
- 31
- 32
- 33
- 34
- 35
- 36
- 37
- 38
- 39
- 40
</div>
</div>
</article>
版权声明
本文为[GuoXuan_ CHN]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/04/202204220735463924.html
边栏推荐
- 感觉写论文太浪费时间,我到底要不要写论文?
- Tensorflow usage notes
- 2022. How to use Chengdu 90 minute unlimited studio
- nacos基础(1):什么是配置中心&Nacos介绍
- 3D 沙盒游戏之人物的点击行走移动
- Blocking queue
- Asnotracking for efcore optimization
- What are the suffocating questions in the interview of computer guarantee research?
- VirtualBox虚拟机(甲骨文Oracle VM )
- 每日一题冲刺大厂第十五天提高组 模
猜你喜欢

BLDC双闭环(速度PI+电流PI)simulink仿真模型

vscode的插件

nacos基础(4):配置nacos外部数据库

如何用c语言实现【猜数字游戏】

The domestic cloud security market has exceeded 10 billion yuan. What is the future development trend?

MySQL in-depth study (Trinity): the use of PowerDesigner

概率论笔记6.3抽样分布

国内知名公共 DNS 服务器居然有你知道哪些

Dual channel optical network with 16 channels of E1 + 2m multi-channel optical transmission equipment

进程和线程
随机推荐
winform中网络开发
ospf四类,五类和七类LSA详解
Redefine China's "core"
pyqt5使用内置数据库sqllite
Visualization of unity perspective projection matrix transformation
AC380V降5V12V24V200MA,超高压非隔离芯片IC方案
encodeURI与encodeURIComponent的区别
Redis entry required
概率论笔记6.3抽样分布
CAS: 36530-06-0 boron chloride phthalocyanine | phthalocyanine | boron chloride phthalocyanine | dichloroboron phthalocyanine dye | boron chloride phthalocyanine | boronsubphalocyaninichloride
Experiment 2: mathematical basis in Data Science
Typescript学习指南
RSYNC及inotify远程同步
Winsock编程接口实验:实现ping
Fluorescent labeled polypeptide / amino acid (FITC modified / AMC modified) Qiyue organism
面经:
Rsync and inotify remote synchronization
Airtest installation and introduction
MySQL深入学习(三二):数据库其它调优策略
用OnLayoutChangeListener的方法解决getTop=0的问题