推荐条+fragment
主布局
package com.example.dell.day1215;
import android.support.design.widget.TabLayout;
import android.support.v4.view.ViewPager;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import com.example.dell.day1215.adapter.MyAdapter;
public class MainActivity extends AppCompatActivity {
private ViewPager viewPager;
private TabLayout tab;
private MyAdapter adapter;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
initView();
initData();
}
private void initData() {
//添加适配器
adapter = new MyAdapter(getSupportFragmentManager());
viewPager.setAdapter(adapter);
tab.setupWithViewPager(viewPager);
}
private void initView() {
//寻找资源id
viewPager = findViewById(R.id.viewpager);
tab = findViewById(R.id.tab);
}
}
适配器
开始适配器
package com.example.dell.day1215.adapter;
import android.support.annotation.Nullable;
import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentPagerAdapter;
import com.example.dell.day1215.fragment.AFragment;
import com.example.dell.day1215.fragment.BFragment;
public class MyAdapter extends FragmentPagerAdapter {
private String[] menues=new String[]{
"电影","资讯","视频","我的"
};
public MyAdapter(FragmentManager fm) {
super(fm);
}
@Nullable
@Override
public CharSequence getPageTitle(int position) {
return menues[position];
}
@Override
public Fragment getItem(int i) {
switch (i){
case 0:
return new AFragment();
case 1:
return new BFragment();
case 2:
return new BFragment();
default:
return new BFragment();
}
}
@Override
public int getCount() {
return menues.length;
}
}
子适配器
package com.example.dell.day1215.adapter;
import android.support.annotation.Nullable;
import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentPagerAdapter;
import com.example.dell.day1215.fragment.aAFragment;
import com.example.dell.day1215.fragment.aBFragment;
public class aMyAdapter extends FragmentPagerAdapter {
//定义集合
private String[] menu=new String[]{
"正在上映","即将上映"
};
public aMyAdapter(FragmentManager fm) {
super(fm);
}
@Nullable
@Override
public CharSequence getPageTitle(int position) {
return menu[position];
}
@Override
public Fragment getItem(int i) {
switch (i){
case 0:
return new aAFragment();
case 1:
return new aBFragment();
}
return null;
}
@Override
public int getCount() {
return menu.length;
}
}
list加载适配器
package com.example.dell.day1215.adapter;
import android.content.Context;
import android.view.LayoutInflater;
import android.view.MotionEvent;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.ImageView;
import android.widget.TextView;
import com.example.dell.day1215.Bean.MovieBean;
import com.example.dell.day1215.R;
import com.nostra13.universalimageloader.core.ImageLoader;
import java.util.ArrayList;
import java.util.List;
public class LISTVIEWBaseAdapter extends BaseAdapter {
private Context context;
private List<MovieBean.ResultBean> list;
public LISTVIEWBaseAdapter(Context context) {
this.context = context;
list=new ArrayList<>();
}
//更新数据
public void setList(List<MovieBean.ResultBean> list1) {
list.clear();
if (list1!=null){
this.list = list1;
}
notifyDataSetChanged();
}
//追加数据
public void addData(List<MovieBean.ResultBean> d){
if (d!=null){
list.addAll(d);
}
notifyDataSetChanged();
}
@Override
public int getCount() {
return list.size();
}
@Override
public Object getItem(int position) {
return list.get(position);
}
@Override
public long getItemId(int position) {
return position;
}
@Override
public View getView(int position, View convertView, ViewGroup parent) {
ViewHolder holder;
if (convertView==null){
holder = new ViewHolder();
convertView=LayoutInflater.from(context).inflate(R.layout.list,parent,false);
holder.img=convertView.findViewById(R.id.img);
holder.text=convertView.findViewById(R.id.text);
convertView.setTag(holder);
}else{
holder = (ViewHolder) convertView.getTag();
}
holder.text.setText(list.get(position).getName());
ImageLoader.getInstance().displayImage(list.get(position).getImageUrl(),holder.img);
return convertView;
}
class ViewHolder{
ImageView img;
TextView text;
}
}
list2适配器
package com.example.dell.day1215.adapter;
import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.ImageView;
import android.widget.TextView;
import com.example.dell.day1215.Bean.MovieBean;
import com.example.dell.day1215.R;
import com.nostra13.universalimageloader.core.ImageLoader;
import java.util.ArrayList;
import java.util.List;
public class LISTVIEWBaseAdapter2 extends BaseAdapter {
private Context context;
private List<MovieBean.ResultBean> blist;
public LISTVIEWBaseAdapter2(Context context) {
this.context = context;
blist=new ArrayList<>();
}
public void setBlist(List<MovieBean.ResultBean> blist1) {
blist.clear();
if (blist1!=null){
this.blist = blist;
}
notifyDataSetChanged();
}
public void addDatab(List<MovieBean.ResultBean> n){
if (n!=null){
blist.addAll(n);
}
notifyDataSetChanged();
}
@Override
public int getCount() {
return blist.size();
}
@Override
public Object getItem(int position) {
return blist.get(position);
}
@Override
public long getItemId(int position) {
return position;
}
@Override
public View getView(int position, View convertView, ViewGroup parent) {
ViewHolder2 holder;
if (convertView==null){
holder = new LISTVIEWBaseAdapter2.ViewHolder2();
convertView=LayoutInflater.from(context).inflate(R.layout.list,parent,false);
holder.img=convertView.findViewById(R.id.img);
holder.text=convertView.findViewById(R.id.text);
convertView.setTag(holder);
}else{
holder = (LISTVIEWBaseAdapter2.ViewHolder2) convertView.getTag();
}
holder.text.setText(blist.get(position).getName());
ImageLoader.getInstance().displayImage(blist.get(position).getImageUrl(),holder.img);
return convertView;
}
class ViewHolder2{
ImageView img;
TextView text;
}
}
Bean类
package com.example.dell.day1215.Bean;
import java.util.List;
public class MovieBean {
private String message;
private String status;
private List<ResultBean> result;
public String getMessage() {
return message;
}
public void setMessage(String message) {
this.message = message;
}
public String getStatus() {
return status;
}
public void setStatus(String status) {
this.status = status;
}
public List<ResultBean> getResult() {
return result;
}
public void setResult(List<ResultBean> result) {
this.result = result;
}
public static class ResultBean {
private boolean followMovie;
private int id;
private String imageUrl;
private String name;
private int rank;
private String summary;
public boolean isFollowMovie() {
return followMovie;
}
public void setFollowMovie(boolean followMovie) {
this.followMovie = followMovie;
}
public int getId() {
return id;
}
public void setId(int id) {
this.id = id;
}
public String getImageUrl() {
return imageUrl;
}
public void setImageUrl(String imageUrl) {
this.imageUrl = imageUrl;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public int getRank() {
return rank;
}
public void setRank(int rank) {
this.rank = rank;
}
public String getSummary() {
return summary;
}
public void setSummary(String summary) {
this.summary = summary;
}
}
}
fragment
package com.example.dell.day1215.fragment;
import android.os.Bundle;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import android.support.design.widget.TabLayout;
import android.support.v4.app.Fragment;
import android.support.v4.view.ViewPager;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import com.example.dell.day1215.R;
import com.example.dell.day1215.adapter.aMyAdapter;
public class AFragment extends Fragment {
private TabLayout atab;
private ViewPager aviewpager;
@Nullable
@Override
public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
View view = inflater.inflate(R.layout.fragment1, container, false);
return view;
}
@Override
public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceState) {
atab = view.findViewById(R.id.atab);
aviewpager = view.findViewById(R.id.aviewpager);
//设置适配器
aMyAdapter adapter = new aMyAdapter(getChildFragmentManager());
aviewpager.setAdapter(adapter);
atab.setupWithViewPager(aviewpager);
}
}
fragment1
package com.example.dell.day1215.fragment;
import android.os.Bundle;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import android.support.v4.app.Fragment;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import com.example.dell.day1215.R;
public class BFragment extends Fragment {
@Nullable
@Override
public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
View view = inflater.inflate(R.layout.fragment2, container, false);
return view;
}
}
子fragment
package com.example.dell.day1215.fragment;
import android.os.Bundle;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import android.support.v4.app.Fragment;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ListView;
import android.widget.Toast;
import com.example.dell.day1215.Bean.MovieBean;
import com.example.dell.day1215.R;
import com.example.dell.day1215.adapter.LISTVIEWBaseAdapter;
import com.example.dell.day1215.util.NewUtil;
import com.handmark.pulltorefresh.library.PullToRefreshBase;
import com.handmark.pulltorefresh.library.PullToRefreshListView;
public class aAFragment extends Fragment {
private PullToRefreshListView pull;
private LISTVIEWBaseAdapter adapter;
private String uri="http://172.17.8.100/movieApi/movie/v1/findHotMovieList?count=10&page=";
private int page=1;
@Nullable
@Override
public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
View view = inflater.inflate(R.layout.afragment1, container, false);
return view;
}
@Override
public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceState) {
super.onViewCreated(view, savedInstanceState);
pull = view.findViewById(R.id.pull);
//添加适配器
adapter = new LISTVIEWBaseAdapter(getContext());
pull.setAdapter(adapter);
pull.setMode(PullToRefreshBase.Mode.BOTH);
pull.setOnRefreshListener(new PullToRefreshBase.OnRefreshListener2<ListView>() {
@Override
public void onPullDownToRefresh(PullToRefreshBase<ListView> refreshView) { //下载
page=1;
//初始化数据
initData();
}
@Override
public void onPullUpToRefresh(PullToRefreshBase<ListView> refreshView) { //刷新
initData();
page++;
}
});
initData();
}
private void initData() {
NewUtil.requestData(uri + page, MovieBean.class, new NewUtil.CallBack<MovieBean>() {
@Override
public void onsuccess(MovieBean nowBean) {
if (nowBean.getResult().size()==0){
pull.onRefreshComplete();
Toast.makeText(getActivity(),"没有数据",Toast.LENGTH_SHORT).show();
}
if (page==1){ //更新
adapter.setList(nowBean.getResult());
}else{ //追加
adapter.addData(nowBean.getResult());
}
page++;
pull.onRefreshComplete();
}
});
}
}
子2布局
package com.example.dell.day1215.fragment;
import android.os.Bundle;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import android.support.v4.app.Fragment;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ListView;
import android.widget.Toast;
import com.example.dell.day1215.Bean.MovieBean;
import com.example.dell.day1215.R;
import com.example.dell.day1215.adapter.LISTVIEWBaseAdapter2;
import com.example.dell.day1215.util.NewUtil;
import com.handmark.pulltorefresh.library.PullToRefreshBase;
import com.handmark.pulltorefresh.library.PullToRefreshListView;
public class aBFragment extends Fragment {
private PullToRefreshListView pull;
private String uri="http://172.17.8.100/movieApi/movie/v1/findHotMovieList?count=10&page=";
private int page=1;
private LISTVIEWBaseAdapter2 adapter2;
@Nullable
@Override
public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
View view = inflater.inflate(R.layout.afragment1, container, false);
return view;
}
@Override
public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceState) {
super.onViewCreated(view, savedInstanceState);
pull = view.findViewById(R.id.pull);
//添加适配器
adapter2 = new LISTVIEWBaseAdapter2(getContext());
pull.setAdapter(adapter2);
pull.setMode(PullToRefreshBase.Mode.BOTH);
pull.setOnRefreshListener(new PullToRefreshBase.OnRefreshListener2<ListView>() {
@Override
public void onPullDownToRefresh(PullToRefreshBase<ListView> refreshView) { //下载
page=1;
//初始化数据
initData();
}
@Override
public void onPullUpToRefresh(PullToRefreshBase<ListView> refreshView) { //刷新
initData();
page++;
}
});
initData();
}
private void initData() {
NewUtil.requestData(uri + page, MovieBean.class, new NewUtil.CallBack<MovieBean>() {
@Override
public void onsuccess(MovieBean downBean) {
if (downBean.getResult().size()==0){
pull.onRefreshComplete();
Toast.makeText(getActivity(),"没有数据",Toast.LENGTH_SHORT).show();
}
if (page==1){ //更新
adapter2.setBlist(downBean.getResult());
}else{ //追加
adapter2.addDatab(downBean.getResult());
}
page++;
pull.onRefreshComplete();
}
});
}
}
sqi类
package com.example.dell.day1215.sqilite;
import android.content.Context;
import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteOpenHelper;
public class SQLiteHelper extends SQLiteOpenHelper {
public SQLiteHelper(Context context) {
super(context,"User.db", null, 1);
}
@Override
public void onCreate(SQLiteDatabase db) {
db.execSQL("create table data(id integer primary key autoincrement," +
"title text," +
"summary text," +
"image_url text)");
}
@Override
public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {
}
}
util
package com.example.dell.day1215.util;
import android.annotation.SuppressLint;
import android.os.AsyncTask;
import com.google.gson.Gson;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.net.HttpURLConnection;
import java.net.MalformedURLException;
import java.net.URL;
import java.net.URLConnection;
import static android.icu.lang.UCharacter.GraphemeClusterBreak.T;
public class NewUtil {
public interface CallBack<T>{
void onsuccess(T t);
}
@SuppressLint("StaticFieldLeak")
public static void requestData(String e, final Class calzz, final CallBack callBack){
new AsyncTask<String,Void,Object>(){
@Override
protected Object doInBackground(String... strings) {
return requestData(strings[0],calzz);
}
@Override
protected void onPostExecute(Object o) {
callBack.onsuccess(o);
}
}.execute(e);
}
private static <T> T requestData(String string, Class calzz) {
return(T) new Gson().fromJson(requestData(string),calzz);
}
private static String requestData(String string) {
try {
URL url = new URL(string);
HttpURLConnection urlConnection = (HttpURLConnection) url.openConnection();
urlConnection.setConnectTimeout(5000);
urlConnection.setReadTimeout(5000);
int responseCode = urlConnection.getResponseCode();
if (responseCode==200){
String result=stream2String(urlConnection.getInputStream());
return result;
}
} catch (MalformedURLException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
}
return null;
}
private static String stream2String(InputStream inputStream) throws IOException {
StringBuilder stringBuilder = new StringBuilder();
BufferedReader br = new BufferedReader(new InputStreamReader(inputStream));
for (String tmp=br.readLine();tmp!=null;tmp=br.readLine()){
stringBuilder.append(tmp);
}
return stringBuilder.toString();
}
}
APP设置图片
package com.example.dell.day1215;
import android.app.Application;
import android.graphics.Bitmap;
import com.nostra13.universalimageloader.core.DisplayImageOptions;
import com.nostra13.universalimageloader.core.ImageLoader;
import com.nostra13.universalimageloader.core.ImageLoaderConfiguration;
public class App extends Application {
@Override
public void onCreate() {
super.onCreate();
ImageLoaderConfiguration loaderConfiguration = new ImageLoaderConfiguration.Builder(this)
.memoryCacheSize(10)
.diskCacheSize(10 * 1024 * 1024)
.defaultDisplayImageOptions(new DisplayImageOptions.Builder()
.bitmapConfig(Bitmap.Config.RGB_565)
.showImageOnLoading(R.mipmap.ic_launcher)
.showImageOnFail(R.mipmap.ic_launcher)
.showImageForEmptyUri(R.mipmap.ic_launcher)
.cacheOnDisk(true)
.cacheInMemory(true)
.build()
).build();
ImageLoader.getInstance().init(loaderConfiguration);
}
}
抽取类
package com.example.dell.day1215;
import android.content.Context;
import android.os.Bundle;
import android.os.PersistableBundle;
import android.support.annotation.Nullable;
import android.support.v7.app.AppCompatActivity;
import android.util.AttributeSet;
import android.view.View;
public abstract class BaseActivity extends AppCompatActivity {
@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
initData();
initView();
}
protected abstract void initView();
protected abstract void initData();
}
布局viewPager+Fragment+侧拉
<?xml version="1.0" encoding="utf-8"?>
<android.support.v4.widget.DrawerLayout 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:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".MainActivity">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<android.support.v4.view.ViewPager
android:id="@+id/viewpager"
android:layout_weight="1"
android:background="#ff00"
android:layout_width="match_parent"
android:layout_height="700dp">
</android.support.v4.view.ViewPager>
<android.support.design.widget.TabLayout
android:id="@+id/tab"
app:tabMode="fixed"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="#ff99"
></android.support.design.widget.TabLayout>
</LinearLayout>
<LinearLayout
android:id="@+id/cela"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:layout_gravity="start"
android:background="#f0f0">
<ImageView
android:layout_width="match_parent"
android:layout_height="150dp"
android:src="@mipmap/ic_launcher"
/>
<LinearLayout
android:layout_gravity="center"
android:layout_weight="1"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<TextView
android:id="@+id/text01"
android:layout_weight="1"
android:textSize="30dp"
android:text="设置头像"
android:layout_gravity="center"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
<TextView
android:id="@+id/text02"
android:layout_weight="1"
android:textSize="30dp"
android:text="放大电路"
android:layout_gravity="center"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
<TextView
android:id="@+id/text03"
android:layout_weight="1"
android:textSize="30dp"
android:text="公开规范"
android:layout_gravity="center"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
</LinearLayout>
</LinearLayout>
</android.support.v4.widget.DrawerLayout>
TabLayout+ViewPager
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
xmlns:app="http://schemas.android.com/apk/res-auto">
<android.support.design.widget.TabLayout
android:id="@+id/atab"
app:tabMode="fixed"
android:background="#0f0"
android:layout_width="match_parent"
android:layout_height="wrap_content">
</android.support.design.widget.TabLayout>
<android.support.v4.view.ViewPager
android:id="@+id/aviewpager"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:background="#f679"
></android.support.v4.view.ViewPager>
</LinearLayout>
来源:https://blog.csdn.net/jiaxiaofei622/article/details/85013037
推荐条+fragment的更多相关文章
- 【转】【Android UI设计与开发】第07期:底部菜单栏(二)Fragment的详细介绍和使用方法
原始地址:http://blog.csdn.net/yangyu20121224/article/category/1431917/1 由于TabActivity在Android4.0以后已经被完全弃 ...
- 对于Fragment的一些理解
前言 Fragment想必大家不陌生吧,在日常开发中,对于Fragment的使用也很频繁,现在主流的APP中,基本的架构也都是一个主页,然后每个Tab项用Fragment做布局,不同选项做切换,使用起 ...
- Android开发 ---Fragment片段布局
前言 Fragment想必大家不陌生吧,在日常开发中,对于Fragment的使用也很频繁,现在主流的APP中,基本的架构也都是一个主页,然后每个Tab项用Fragment做布局,不同选项做切换,使用起 ...
- <Android 基础(三 十)> Fragment (3) ~ PreferenceFragment
简介 PreferenceFragment , 展示一系列的Preference条目并且当与用户有交互时,产生的值会自动保存到SharedPreferences中,通过PreferenceManage ...
- Fragment 底部菜单栏
实例讲解一 实例效果图: 点击wifi“按钮”显示的界面: 项目结构 具体代码编写 1.左边页面布局界面,frag_list.xml: <?xml version="1.0" ...
- Android应用经典主界面框架之中的一个:仿QQ (使用Fragment, 附源代码)
备注:代码已传至https://github.com/yanzi1225627/FragmentProject_QQ 欢迎fork,如今来审视这份代码,非常多地方写的不太好,欢迎大家指正.有时间我会继 ...
- Android开发笔记(10)——使用Fragment传递
转载请注明:http://www.cnblogs.com/igoslly/p/6911165.html 由于最近废寝忘食地在开发App,没来得及及时做总结,没有用很高级的部件,勉强也使用一些功能完成了 ...
- fragment基础 fragment生命周期 兼容低版本
fragment入门 ① 创建一个类继承Fragment 重写oncreateView方法 public class FirstFragment extends Fragment { @Overrid ...
- 基于Tags的简单内容推荐的实现
原来为了简单方便,自己小网站上的文章页的相关内容推荐就是从数据库里随机抽取数据来填充一个列表,所以一点相关性都没有,更本没有办法引导用户去访问推荐内容. 算法选择 如何能做到相似内容的推荐呢,碍于小网 ...
随机推荐
- 2020无损车载音源抖音歌曲下栽经典流行MP3新歌曲视频音乐下载包
2020无损车载音源抖音歌曲下栽经典流行MP3新歌曲视频音乐下载包 偶有几次乘出租车晚归,除了发现出租车司机都很爱听叶文有话要说之外,也发现有的出租车司机还是很有听歌品位的,车载音响系统改的也很棒.有 ...
- day37:MySQL基本操作
目录 part1:登录mysql的完整语法 part2:查询用户/设置密码/去除密码 part3:给ip/网段/所有ip设置账号密码 part4:查看权限 part5:添加权限/删除权限/删除用户 p ...
- 用Springboot+Jpa实现学生CRUD操作(含前端页面,含分页,自定义SQL)
前期准备 使用idea新建个SpringBoot项目 参考博客:https://blog.csdn.net/Mr_Jixian/article/details/89742366?tdsourcetag ...
- Java线上问题排查神器Arthas快速上手与原理浅谈
前言 当你兴冲冲地开始运行自己的Java项目时,你是否遇到过如下问题: 程序在稳定运行了,可是实现的功能点了没反应. 为了修复Bug而上线的新版本,上线后发现Bug依然在,却想不通哪里有问题? 想到可 ...
- 简单易懂的JS继承图解
JS继承的实现方式一共有八种.下面我们来一个一个瞅一下.注意️:文章依据个人理解,难免有问题,还望各位及时指出!!!!! 原型链继承 借用构造函数继承 组合继承 原型式继承 寄生继承 寄生组合式继承 ...
- Apache Tika实战
Apache Tika实战 Tika 简介 Apache Tika 是一个内容分析工具包,可以检测上千种文件类型,并提取它们的元数据和文本.tika在设计上十分精巧,单一的接口使它易于使用,在搜索引擎 ...
- 手写Promise看着一篇就足够了
目录 概要 博客思路 API的特性与手写源码 构造函数 then catch Promise.resolved Promise.rejected Promise.all Promise.race 概要 ...
- 广度优先搜索(BFS)解题总结
定义 广度优先搜索算法(Breadth-First-Search),是一种图形搜索算法. 简单的说,BFS是从根节点开始,沿着树(图)的宽度遍历树(图)的节点. 如果所有节点均被访问,则算法中止. B ...
- 点击穿透事件-----CSS新属性
面试被问,一脸懵,被提示,还蒙,好丢脸的感觉....赶紧百度了解 .noclick{ pointer-events: none; /* 上层加上这句样式可以实现点击穿透 */ } 就是说重叠在一起的两 ...
- 阿里云体验实验室 体验教程《Linux指令入门-系统管理》
体验平台简介 阿里云开发者实验室提供免费云资源和丰富的场景化实践,旨在帮助开发者在学习应用技术,了解阿里云产品的特性. 阿里云体验实验室地址:https://developer.aliyun.com/ ...