ViewPager点击跳转
来源:互联网 发布:nba1516数据库· 编辑:程序博客网 时间:2024/06/04 19:28
======================main_activity================================package com.example.lenovo.bannerviewpager;import android.content.Intent;import android.os.Bundle;import android.support.v7.app.AppCompatActivity;import android.util.Log;import android.widget.Toast;import com.google.gson.Gson;import java.io.IOException;import java.util.ArrayList;import java.util.List;import okhttp3.Call;import okhttp3.Callback;import okhttp3.OkHttpClient;import okhttp3.Request;import okhttp3.Response;public class MainActivity extends AppCompatActivity { private int time = 100; private CustomBanner customBanner; private List<String> list; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); customBanner = (CustomBanner) findViewById(R.id.custom_bannner); customBanner.setTimeSeconds(3); getDataFromNet(); } private void getDataFromNet() { //http://120.27.23.105/ad/getAd //1.创建一个okhttp客户端对象 OkHttpClient okHttpClient = new OkHttpClient(); //2.通过请求的构建器来创建一个请求对象,并指定请求的url地址 Request request = new Request.Builder() .url("http://120.27.23.105/ad/getAd") .build(); //3.客户端调用请求 okHttpClient.newCall(request).enqueue(new Callback() { @Override public void onFailure(Call call, IOException e) { } @Override public void onResponse(Call call, Response response) throws IOException { if (response.isSuccessful()) { final String string = response.body().string();//耗时,子线程获取 runOnUiThread(new Runnable() {//主线程 @Override public void run() { Log.i("---+++", string); BannerBean bannerBean = new Gson().fromJson(string, BannerBean.class); final List<BannerBean.DataBean> data = bannerBean.getData(); list = new ArrayList<>(); for (int i = 0; i < data.size(); i++) { list.add(data.get(i).getIcon()); } customBanner.setImageUrl(list); //设置点击事件 customBanner.setOnBannerClickListner(new CustomBanner.OnBannerClickListner() { @Override public void onBannerClick(int position) { //Toast.makeText(MainActivity.this,"点击了",Toast.LENGTH_SHORT).show(); //判断 BannerBean.DataBean dataBean = data.get(position); if (dataBean.getType() == 0) {//跳转到详情 Intent intent = new Intent(MainActivity.this, SecondActivity.class); intent.putExtra("url", dataBean.getUrl()); ; startActivity(intent); } else if (dataBean.getType() == 1) { Toast.makeText(MainActivity.this, "跳转到商品详情页面", Toast.LENGTH_SHORT).show(); } } }); } }); } } }); }}
================SecondActivity=====================================
package com.example.lenovo.bannerviewpager;import android.support.v7.app.AppCompatActivity;import android.os.Bundle;import android.webkit.WebSettings;import android.webkit.WebView;import android.webkit.WebViewClient;public class SecondActivity extends AppCompatActivity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_second); String url = getIntent().getStringExtra("url"); WebView webView = (WebView) findViewById(R.id.web_view); webView.loadUrl(url); webView.setWebViewClient(new WebViewClient()); WebSettings settings = webView.getSettings(); settings.setJavaScriptCanOpenWindowsAutomatically(true); settings.setJavaScriptEnabled(true); }}=====================BollView====================================
package com.example.lenovo.bannerviewpager;import android.content.Context;import android.graphics.Canvas;import android.graphics.Color;import android.graphics.Paint;import android.support.annotation.Nullable;import android.util.AttributeSet;import android.view.MotionEvent;import android.view.View;/** * Created by Dash on 2017/11/30. * * 点中变色 */public class BollView extends View { public BollView(Context context) { super(context); } public BollView(Context context, @Nullable AttributeSet attrs) { super(context, attrs); } public BollView(Context context, @Nullable AttributeSet attrs, int defStyleAttr) { super(context, attrs, defStyleAttr); } private int cx = 50; private int cy = 50; @Override protected void onDraw(Canvas canvas) { super.onDraw(canvas); Paint paint = new Paint(); paint.setColor(Color.RED); paint.setStyle(Paint.Style.FILL); paint.setAntiAlias(true); canvas.drawCircle(cx,cy,50,paint); } @Override public boolean onTouchEvent(MotionEvent event) { switch (event.getAction()){ case MotionEvent.ACTION_DOWN: cx = (int) event.getX(); cy = (int) event.getY(); break; case MotionEvent.ACTION_MOVE: cx = (int) event.getX(); cy = (int) event.getY(); break; case MotionEvent.ACTION_UP: cx = (int) event.getX(); cy = (int) event.getY(); break; } postInvalidate(); return true; }}===================CombineView ============================================
package com.example.lenovo.bannerviewpager;import android.content.Context;import android.support.annotation.NonNull;import android.support.annotation.Nullable;import android.util.AttributeSet;import android.view.View;import android.widget.CheckBox;import android.widget.FrameLayout;import android.widget.TextView;/** * Created by Dash on 2017/11/30. */public class CombineView extends FrameLayout implements View.OnClickListener { private TextView textView; private CheckBox checkBox; private String text; private boolean checked; public CombineView(@NonNull Context context) { super(context); init(); } public CombineView(@NonNull Context context, @Nullable AttributeSet attrs) { super(context, attrs); text = attrs.getAttributeValue("http://schemas.android.com/apk/res-auto", "text"); checked = attrs.getAttributeBooleanValue("http://schemas.android.com/apk/res-auto", "checked", false); init(); } public CombineView(@NonNull Context context, @Nullable AttributeSet attrs, int defStyleAttr) { super(context, attrs, defStyleAttr); init(); } /** * 初始化的方法 */ private void init() { //让当前的控件关联上写的布局 View view = View.inflate(getContext(), R.layout.combine_layout, this);//第三个参数是否有挂载的父控件 //找到控件 textView = view.findViewById(R.id.text_desc); checkBox = view.findViewById(R.id.check_box); textView.setText(text); checkBox.setChecked(checked); //对当前的自定义控件设置点击事件 this.setOnClickListener(this); } //对外提供设置文本 public void setText(String text){ textView.setText(text); } //设置选中状态 public void setCheck(boolean b){ checkBox.setChecked(b); } //拿到状态 public boolean getCheck(){ return checkBox.isChecked(); } @Override public void onClick(View view) { checkBox.setChecked(! checkBox.isChecked()); }}===============CountView====================================
package com.example.lenovo.bannerviewpager;import android.content.Context;import android.graphics.Canvas;import android.graphics.Color;import android.graphics.Paint;import android.graphics.Rect;import android.support.annotation.Nullable;import android.util.AttributeSet;import android.view.View;import android.view.WindowManager;/** * Created by Dash on 2017/11/29. */public class CountView extends View implements View.OnClickListener { public CountView(Context context) { super(context); init(); } public CountView(Context context, @Nullable AttributeSet attrs) { super(context, attrs); init(); } public CountView(Context context, @Nullable AttributeSet attrs, int defStyleAttr) { super(context, attrs, defStyleAttr); init(); } private int count = 0; @Override protected void onDraw(Canvas canvas) { super.onDraw(canvas); Paint paint = new Paint(); paint.setColor(Color.RED); paint.setAntiAlias(true); paint.setStyle(Paint.Style.FILL_AND_STROKE); paint.setStrokeWidth(1); //中心点 //拿到屏幕的宽高 WindowManager windowManager = (WindowManager) getContext().getSystemService(Context.WINDOW_SERVICE); int width = getMeasuredWidth(); int height = getMeasuredHeight(); canvas.drawCircle(width/2,height/2,200, paint); paint.setColor(Color.BLACK); paint.setTextSize(60); String text = count+""; Rect rect = new Rect(); paint.getTextBounds(text,0,text.length(),rect); canvas.drawText(text,width/2-rect.width()/2,height/2+rect.height()/2,paint);//左下角的点 } //初始化 private void init() { this.setOnClickListener(this); } @Override public void onClick(View view) { count ++; //invalidate(); postInvalidate(); }}=======================CustomBanner ============================
package com.example.lenovo.bannerviewpager;import android.content.Context;import android.graphics.Bitmap;import android.os.Handler;import android.os.Message;import android.support.annotation.NonNull;import android.support.annotation.Nullable;import android.support.v4.view.PagerAdapter;import android.support.v4.view.ViewPager;import android.util.AttributeSet;import android.view.MotionEvent;import android.view.View;import android.view.ViewGroup;import android.widget.FrameLayout;import android.widget.ImageView;import android.widget.LinearLayout;import com.nostra13.universalimageloader.cache.disc.impl.UnlimitedDiskCache;import com.nostra13.universalimageloader.cache.disc.naming.HashCodeFileNameGenerator;import com.nostra13.universalimageloader.cache.memory.impl.LruMemoryCache;import com.nostra13.universalimageloader.core.DisplayImageOptions;import com.nostra13.universalimageloader.core.ImageLoader;import com.nostra13.universalimageloader.core.ImageLoaderConfiguration;import com.nostra13.universalimageloader.core.assist.ImageScaleType;import com.nostra13.universalimageloader.core.assist.QueueProcessingType;import com.nostra13.universalimageloader.core.display.SimpleBitmapDisplayer;import com.nostra13.universalimageloader.core.download.BaseImageDownloader;import com.nostra13.universalimageloader.utils.StorageUtils;import java.io.File;import java.util.ArrayList;import java.util.List;/** * Created by Dash on 2017/12/2. */public class CustomBanner extends FrameLayout { private ViewPager viewPager; private LinearLayout linearLayout; private List<String> list; private int time = 2; private Handler handler = new Handler(){ @Override public void handleMessage(Message msg) { if (msg.what == 0){ //viewPager显示下一页 viewPager.setCurrentItem(viewPager.getCurrentItem() +1); //再次发送延时消息 handler.sendEmptyMessageDelayed(0,time*1000); } } }; private ArrayList<ImageView> images; private OnBannerClickListner bannerClickListner; public CustomBanner(@NonNull Context context) { super(context); init(); } public CustomBanner(@NonNull Context context, @Nullable AttributeSet attrs) { super(context, attrs); init(); } public CustomBanner(@NonNull Context context, @Nullable AttributeSet attrs, int defStyleAttr) { super(context, attrs, defStyleAttr); init(); } /** * 对外提供设置时间 */ public void setTimeSeconds(int time){ this.time = time; } /** * 初始化的方法,,,加载布局 */ private void init() { //初始化imageLoader ImageLoaderUtil.init(getContext()); View view = View.inflate(getContext(), R.layout.custom_banner_layout, this); //找到控件 viewPager = view.findViewById(R.id.view_pager); linearLayout = view.findViewById(R.id.linear_layout); } /** * 对外提供设置数据的方法 */ public void setImageUrl(List<String> list){ this.list = list; if (list == null){ return; } //设置适配器 MyAdapter myAdapter = new MyAdapter(getContext(), list); //设置适配器 viewPager.setAdapter(myAdapter); initDoc(list); //2.手动的可以无限滑动 viewPager.setCurrentItem(list.size()*100000);//设置当前展示中间某个足够大的位置 handler.sendEmptyMessageDelayed(0,time*1000);//发送一个延时的空消息 //viewPage设置监听事件 viewPager.setOnPageChangeListener(new ViewPager.OnPageChangeListener() { @Override public void onPageScrolled(int position, float positionOffset, int positionOffsetPixels) { } /** * 当选中某个页面的时候,把当前的小圆点背景变成绿色 * @param position */ @Override public void onPageSelected(int position) { for (int i=0;i<images.size();i++){ if (i == position%images.size()){ images.get(i).setImageResource(R.drawable.shape_01); }else { images.get(i).setImageResource(R.drawable.shape_02); } } } @Override public void onPageScrollStateChanged(int state) { } }); } /** * 动态添加小圆点 * @param list */ private void initDoc(List<String> list) { //1.需要一个集合记录一下小圆点的imageView控件 images = new ArrayList<ImageView>(); //2...linearLayout上面的视图清空一下再去添加 linearLayout.removeAllViews(); for (int i=0;i<list.size();i++){ ImageView imageView = new ImageView(getContext()); if (i==0){ imageView.setImageResource(R.drawable.shape_01); }else { imageView.setImageResource(R.drawable.shape_02); } //添加到集合去 images.add(imageView); //添加到线性布局上 //这是布局参数,,刚开始小圆点之间没有距离,所以使用java代码指定宽度高度,并且指定小圆点之间的距离 LinearLayout.LayoutParams params = new LinearLayout.LayoutParams(LinearLayout.LayoutParams.WRAP_CONTENT,LinearLayout.LayoutParams.WRAP_CONTENT); params.setMargins(5,0,5,0); linearLayout.addView(imageView,params); } } private class MyAdapter extends PagerAdapter { Context context; List<String> list; public MyAdapter(Context context, List<String> list) { this.context = context; this.list = list; } @Override public int getCount() { return Integer.MAX_VALUE; } @Override public boolean isViewFromObject(View view, Object object) { return view == object; } /** * viewPager具有预加载,默认的前后加载一页,,,默认的容器里面最多三页 * @param container * @param position * @return */ @Override public Object instantiateItem(ViewGroup container, final int position) { //1.把这个当前展示的视图添加到容器中...container ImageView imageView = new ImageView(context); //..........使图片平铺整个imageView控件 imageView.setScaleType(ImageView.ScaleType.FIT_XY); //imageLoader加载图片到这个imageView控件上 ImageLoader.getInstance().displayImage(list.get(position %list.size()),imageView,ImageLoaderUtil.getDefaultOption()); //给imageView设置触摸的监听事件 imageView.setOnTouchListener(new OnTouchListener() { @Override public boolean onTouch(View view, MotionEvent motionEvent) { int action = motionEvent.getAction();//获取手指的动作 switch (action){ case MotionEvent.ACTION_DOWN://按下的动作...应该取消发送消息的操作 handler.removeCallbacksAndMessages(null); break; case MotionEvent.ACTION_MOVE://移动的动作 handler.removeCallbacksAndMessages(null); break; case MotionEvent.ACTION_CANCEL://取消 //重新发送 handler.sendEmptyMessageDelayed(0,time*1000); break; case MotionEvent.ACTION_UP://抬起的动作 handler.sendEmptyMessageDelayed(0,time*1000); break; } return false; } }); imageView.setOnClickListener(new OnClickListener() { @Override public void onClick(View view) { bannerClickListner.onBannerClick(position%list.size()); } }); container.addView(imageView);//添加到容器 //2.把当前展示的视图返回 return imageView; } @Override public void destroyItem(ViewGroup container, int position, Object object) { //销毁视图 container.removeView((View) object); } } private static class ImageLoaderUtil { /** * 初始化 * * @param context */ public static void init(Context context) { File cacheDir = StorageUtils.getCacheDirectory(context); //缓存文件夹路径 ImageLoaderConfiguration config = new ImageLoaderConfiguration.Builder(context) .threadPoolSize(3) // default 线程池内加载的数量 .threadPriority(Thread.NORM_PRIORITY - 2) // default 设置当前线程的优先级 .tasksProcessingOrder(QueueProcessingType.FIFO) // default .denyCacheImageMultipleSizesInMemory() .memoryCache(new LruMemoryCache(2 * 1024 * 1024)) //可以通过自己的内存缓存实现 .memoryCacheSize(2 * 1024 * 1024) // 内存缓存的最大值 .memoryCacheSizePercentage(13) // default .diskCache(new UnlimitedDiskCache(cacheDir)) // default 可以自定义缓存路径 .diskCacheSize(50 * 1024 * 1024) // 50 Mb sd卡(本地)缓存的最大值 .diskCacheFileCount(100) // 可以缓存的文件数量 // default为使用HASHCODE对UIL进行加密命名, 还可以用MD5(new Md5FileNameGenerator())加密 .diskCacheFileNameGenerator(new HashCodeFileNameGenerator()) .imageDownloader(new BaseImageDownloader(context)) // default .defaultDisplayImageOptions(DisplayImageOptions.createSimple()) // default .writeDebugLogs() // 打印debug log .build(); //开始构建 //关键初始化的代码 ImageLoader.getInstance().init(config); } public static DisplayImageOptions getDefaultOption() { DisplayImageOptions options = new DisplayImageOptions.Builder() .showImageOnLoading(R.mipmap.ic_launcher) // 设置图片下载期间显示的图片 .showImageForEmptyUri(R.mipmap.ic_launcher) // 设置图片Uri为空或是错误的时候显示的图片 .showImageOnFail(R.mipmap.ic_launcher) // 设置图片加载或解码过程中发生错误显示的图片 .resetViewBeforeLoading(true) // default 设置图片在加载前是否重置、复位 .cacheInMemory(true) // default 设置下载的图片是否缓存在内存中 .cacheOnDisk(true) // default 设置下载的图片是否缓存在SD卡中 .considerExifParams(true) // default .imageScaleType(ImageScaleType.IN_SAMPLE_POWER_OF_2) // default 设置图片以如何的编码方式显示 .bitmapConfig(Bitmap.Config.ARGB_8888) // default 设置图片的解码类型 .displayer(new SimpleBitmapDisplayer()) // default 还可以设置圆角图片new RoundedBitmapDisplayer(20) .build(); return options; } } public void setOnBannerClickListner(OnBannerClickListner bannerClickListner){ this.bannerClickListner = bannerClickListner; } /** * 点击的接口 */ public interface OnBannerClickListner { public void onBannerClick(int position); }}======================DrawView ==========================================
package com.example.lenovo.bannerviewpager;import android.content.Context;import android.graphics.Canvas;import android.graphics.Color;import android.graphics.Paint;import android.support.annotation.Nullable;import android.util.AttributeSet;import android.view.View;/** * Created by Dash on 2017/11/29. */public class DrawView extends View { public DrawView(Context context) { super(context); } public DrawView(Context context, @Nullable AttributeSet attrs) { super(context, attrs); } public DrawView(Context context, @Nullable AttributeSet attrs, int defStyleAttr) { super(context, attrs, defStyleAttr); } @Override protected void onDraw(Canvas canvas) { super.onDraw(canvas); //在画布上绘制....圆心坐标...半径...画笔 Paint paint = new Paint(); paint.setColor(Color.RED); paint.setStyle(Paint.Style.STROKE); paint.setStrokeWidth(5); paint.setAntiAlias(true);//设置抗锯齿 canvas.drawCircle(100,100,100,paint); }}====================LayoutView ============================
package com.example.lenovo.bannerviewpager;import android.content.Context;import android.util.AttributeSet;import android.view.View;import android.view.ViewGroup;/** * Created by Dash on 2017/11/29. */public class LayoutView extends ViewGroup { public LayoutView(Context context) { super(context); } public LayoutView(Context context, AttributeSet attrs) { super(context, attrs); } public LayoutView(Context context, AttributeSet attrs, int defStyleAttr) { super(context, attrs, defStyleAttr); } @Override protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) { super.onMeasure(widthMeasureSpec, heightMeasureSpec); if (getChildCount()>0){ View childAt = getChildAt(0); //布局(viewGroup)可以测量里面子控件的大小 measureChild(childAt,widthMeasureSpec,heightMeasureSpec); } } //viewGroup中放置里面控件的方法 @Override protected void onLayout(boolean b, int i, int i1, int i2, int i3) { //1.先拿到里面的子控件 int childCount = getChildCount(); if (childCount>0){ View childView = getChildAt(0); //设置当前子控件在父控件(LayoutView)的位置 //获取到当前子控件的宽度和高度然后设置左上右下 childView.layout(10,10,childView.getMeasuredHeight()+10,childView.getMeasuredWidth()+10); } }}===================MeasureView ========================
package com.example.lenovo.bannerviewpager;import android.content.Context;import android.support.annotation.Nullable;import android.util.AttributeSet;import android.view.View;import android.widget.Toast;/** * Created by Dash on 2017/11/29. */public class MeasureView extends View { //new的时候使用的是这个构造方法 public MeasureView(Context context) { super(context); init(); } /** * 初始化的方法 */ private void init() { } //在布局xml里面引用的时候,调用的这个构造方法 public MeasureView(Context context, @Nullable AttributeSet attrs) { super(context, attrs); init(); } //也是在布局文件中引用的时候,只不过在使用主题的时候使用一般就是应用的默认主题 public MeasureView(Context context, @Nullable AttributeSet attrs, int defStyleAttr) { super(context, attrs, defStyleAttr); init(); } @Override protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) { super.onMeasure(widthMeasureSpec, heightMeasureSpec); //获取具体的大小和模式....初始设置的值 int width = MeasureSpec.getSize(widthMeasureSpec); int height = MeasureSpec.getSize(heightMeasureSpec); if (MeasureSpec.getMode(widthMeasureSpec) == MeasureSpec.EXACTLY){ Toast.makeText(getContext(),"size:"+width,Toast.LENGTH_SHORT).show(); } //onMeasure方法里面直接调用这个方法可以确定大小 setMeasuredDimension(200,200); }}=================PointView =========================================
package com.example.lenovo.bannerviewpager;import android.content.Context;import android.graphics.Canvas;import android.graphics.Color;import android.graphics.Paint;import android.support.annotation.Nullable;import android.util.AttributeSet;import android.view.View;/** * Created by Dash on 2017/11/29. */public class PointView extends View { public PointView(Context context) { super(context); } public PointView(Context context, @Nullable AttributeSet attrs) { super(context, attrs); } public PointView(Context context, @Nullable AttributeSet attrs, int defStyleAttr) { super(context, attrs, defStyleAttr); } @Override protected void onDraw(Canvas canvas) { super.onDraw(canvas); Paint paint = new Paint(); paint.setColor(Color.BLACK); paint.setStyle(Paint.Style.FILL); paint.setStrokeWidth(2); paint.setAntiAlias(true); canvas.drawPoint(100,100,paint); }}====================TimeProgressView =======================================
package com.example.lenovo.bannerviewpager;import android.content.Context;import android.graphics.Canvas;import android.graphics.Color;import android.graphics.Paint;import android.graphics.Rect;import android.graphics.RectF;import android.support.annotation.Nullable;import android.util.AttributeSet;import android.view.View;/** * Created by Dash on 2017/11/30. */public class TimeProgressView extends View { private int progress; private int max = 100; private String text = ""; public TimeProgressView(Context context) { super(context); } public TimeProgressView(Context context, @Nullable AttributeSet attrs) { super(context, attrs); } public TimeProgressView(Context context, @Nullable AttributeSet attrs, int defStyleAttr) { super(context, attrs, defStyleAttr); } @Override protected void onDraw(Canvas canvas) { super.onDraw(canvas); Paint paint = new Paint(); paint.setColor(Color.RED); paint.setStyle(Paint.Style.STROKE); paint.setStrokeWidth(1); paint.setAntiAlias(true); canvas.drawCircle(getMeasuredWidth()/2,getMeasuredHeight()/2,getMeasuredWidth()/2,paint); paint.setStrokeWidth(5); paint.setColor(Color.GREEN); RectF rectf = new RectF(0,0,getMeasuredWidth(),getMeasuredHeight()); // canvas.drawArc(rectf,-90,360*progress/max,false,paint); paint.setColor(Color.BLACK); paint.setStrokeWidth(1); paint.setTextSize(30);//设置字体大小放在测量之前 Rect rect = new Rect(); paint.getTextBounds(text,0,text.length(),rect); canvas.drawText(text,getMeasuredWidth()/2-rect.width()/2,getMeasuredHeight()/2+rect.height()/2,paint); } public void setMax(int max){ this.max = max; } public void setProgressAndText(int progress,String text){ this.progress = progress; this.text = text; //绘制 postInvalidate(); } public void initText(String text){ this.text = text; }}=============activity_main=========================================
<?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:dash="http://schemas.android.com/apk/res-auto" android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="vertical" > <wangaimin.bwie.com.example.lenovo.bannerviewpager.CustomBanner android:id="@+id/custom_bannner" android:layout_width="match_parent" android:layout_height="wrap_content" /></LinearLayout>===================activity_second========================================
<?xml version="1.0" encoding="utf-8"?><android.support.constraint.ConstraintLayout 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=".SecondActivity"> <WebView android:id="@+id/web_view" android:layout_width="match_parent" android:layout_height="match_parent"> </WebView></android.support.constraint.ConstraintLayout>===============combine_layout==================================================
<?xml version="1.0" encoding="utf-8"?><LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"android:orientation="horizontal"android:layout_width="match_parent"android:layout_height="wrap_content"><TextView android:layout_width="0dp" android:layout_weight="1" android:layout_height="wrap_content" android:text="hahhahah" android:id="@+id/text_desc" /><CheckBox android:id="@+id/check_box" android:layout_width="wrap_content" android:layout_height="wrap_content" /></LinearLayout>================custom_banner_layout========================================
<?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.support.v4.view.ViewPager android:id="@+id/view_pager" android:layout_width="match_parent" android:layout_height="200dp"> </android.support.v4.view.ViewPager> <LinearLayout android:id="@+id/linear_layout" android:orientation="horizontal" android:layout_centerHorizontal="true" android:layout_alignBottom="@+id/view_pager" android:layout_marginBottom="10dp" android:layout_width="wrap_content" android:layout_height="wrap_content"> </LinearLayout></RelativeLayout>==========ic_launcher_background.xml==========================================
<?xml version="1.0" encoding="utf-8"?><vector xmlns:android="http://schemas.android.com/apk/res/android" android:width="108dp" android:height="108dp" android:viewportHeight="108" android:viewportWidth="108"> <path android:fillColor="#26A69A" android:pathData="M0,0h108v108h-108z" /> <path android:fillColor="#00000000" android:pathData="M9,0L9,108" android:strokeColor="#33FFFFFF" android:strokeWidth="0.8" /> <path android:fillColor="#00000000" android:pathData="M19,0L19,108" android:strokeColor="#33FFFFFF" android:strokeWidth="0.8" /> <path android:fillColor="#00000000" android:pathData="M29,0L29,108" android:strokeColor="#33FFFFFF" android:strokeWidth="0.8" /> <path android:fillColor="#00000000" android:pathData="M39,0L39,108" android:strokeColor="#33FFFFFF" android:strokeWidth="0.8" /> <path android:fillColor="#00000000" android:pathData="M49,0L49,108" android:strokeColor="#33FFFFFF" android:strokeWidth="0.8" /> <path android:fillColor="#00000000" android:pathData="M59,0L59,108" android:strokeColor="#33FFFFFF" android:strokeWidth="0.8" /> <path android:fillColor="#00000000" android:pathData="M69,0L69,108" android:strokeColor="#33FFFFFF" android:strokeWidth="0.8" /> <path android:fillColor="#00000000" android:pathData="M79,0L79,108" android:strokeColor="#33FFFFFF" android:strokeWidth="0.8" /> <path android:fillColor="#00000000" android:pathData="M89,0L89,108" android:strokeColor="#33FFFFFF" android:strokeWidth="0.8" /> <path android:fillColor="#00000000" android:pathData="M99,0L99,108" android:strokeColor="#33FFFFFF" android:strokeWidth="0.8" /> <path android:fillColor="#00000000" android:pathData="M0,9L108,9" android:strokeColor="#33FFFFFF" android:strokeWidth="0.8" /> <path android:fillColor="#00000000" android:pathData="M0,19L108,19" android:strokeColor="#33FFFFFF" android:strokeWidth="0.8" /> <path android:fillColor="#00000000" android:pathData="M0,29L108,29" android:strokeColor="#33FFFFFF" android:strokeWidth="0.8" /> <path android:fillColor="#00000000" android:pathData="M0,39L108,39" android:strokeColor="#33FFFFFF" android:strokeWidth="0.8" /> <path android:fillColor="#00000000" android:pathData="M0,49L108,49" android:strokeColor="#33FFFFFF" android:strokeWidth="0.8" /> <path android:fillColor="#00000000" android:pathData="M0,59L108,59" android:strokeColor="#33FFFFFF" android:strokeWidth="0.8" /> <path android:fillColor="#00000000" android:pathData="M0,69L108,69" android:strokeColor="#33FFFFFF" android:strokeWidth="0.8" /> <path android:fillColor="#00000000" android:pathData="M0,79L108,79" android:strokeColor="#33FFFFFF" android:strokeWidth="0.8" /> <path android:fillColor="#00000000" android:pathData="M0,89L108,89" android:strokeColor="#33FFFFFF" android:strokeWidth="0.8" /> <path android:fillColor="#00000000" android:pathData="M0,99L108,99" android:strokeColor="#33FFFFFF" android:strokeWidth="0.8" /> <path android:fillColor="#00000000" android:pathData="M19,29L89,29" android:strokeColor="#33FFFFFF" android:strokeWidth="0.8" /> <path android:fillColor="#00000000" android:pathData="M19,39L89,39" android:strokeColor="#33FFFFFF" android:strokeWidth="0.8" /> <path android:fillColor="#00000000" android:pathData="M19,49L89,49" android:strokeColor="#33FFFFFF" android:strokeWidth="0.8" /> <path android:fillColor="#00000000" android:pathData="M19,59L89,59" android:strokeColor="#33FFFFFF" android:strokeWidth="0.8" /> <path android:fillColor="#00000000" android:pathData="M19,69L89,69" android:strokeColor="#33FFFFFF" android:strokeWidth="0.8" /> <path android:fillColor="#00000000" android:pathData="M19,79L89,79" android:strokeColor="#33FFFFFF" android:strokeWidth="0.8" /> <path android:fillColor="#00000000" android:pathData="M29,19L29,89" android:strokeColor="#33FFFFFF" android:strokeWidth="0.8" /> <path android:fillColor="#00000000" android:pathData="M39,19L39,89" android:strokeColor="#33FFFFFF" android:strokeWidth="0.8" /> <path android:fillColor="#00000000" android:pathData="M49,19L49,89" android:strokeColor="#33FFFFFF" android:strokeWidth="0.8" /> <path android:fillColor="#00000000" android:pathData="M59,19L59,89" android:strokeColor="#33FFFFFF" android:strokeWidth="0.8" /> <path android:fillColor="#00000000" android:pathData="M69,19L69,89" android:strokeColor="#33FFFFFF" android:strokeWidth="0.8" /> <path android:fillColor="#00000000" android:pathData="M79,19L79,89" android:strokeColor="#33FFFFFF" android:strokeWidth="0.8" /></vector>====================shape_01.xml=========================================
<?xml version="1.0" encoding="utf-8"?><shape xmlns:android="http://schemas.android.com/apk/res/android"> <solid android:color="#00ff00"/> <corners android:radius="10dp"/> <size android:height="10dp" android:width="10dp"/></shape>====================shape_02.xml=======================================
<?xml version="1.0" encoding="utf-8"?><shape xmlns:android="http://schemas.android.com/apk/res/android"> <solid android:color="#ff0000"/> <corners android:radius="10dp"/> <size android:height="10dp" android:width="10dp"/></shape>
阅读全文
0 0
- ViewPager点击跳转
- ViewPager子页中实现点击跳转
- 点击ViewPager跳转到指定页面
- Android中点击ViewPager实现跳转页面
- 点击新闻条目跳转viewpager+photoview显示图片
- 使用ViewPager实现页面滑动(点击)跳转效果(类似于微信页面)
- ViewPager + Fragment处理两个Fragment的点击跳转以及之间的传递数据
- viewpager的setCurrentItem 底部导航栏点击按钮实现直接跳转,去掉滑动效果
- ViewPager广告中的图片请求自网络,监听跳转至点击图片对应Url的webView
- 点击第一viewpager中的按钮,跳转到第二个radiogroup对应的fragment
- viewpager和fragment实现的tab页面如何实现点击跳转
- viewpager和fragment实现的tab页面如何实现点击跳转
- ViewPager + Fragment处理两个Fragment的点击跳转以及之间的传递数据
- 在ViewPager中实现两个fragment之间点击跳转与几种数据传递的方法
- Viewpager的竖直切换及其子fragment之间的点击跳转
- 跳转+gridview+viewpager
- Viewpager实现跳转
- 自定义ViewPager+WebView跳转
- linux下安装python
- laravel
- HDU 5698-瞬间移动
- Retrofit3
- 五、 统计学习理论:无界实损失函数上的大数定理
- ViewPager点击跳转
- 自定义控件----继承framLayout --textview与checkBox
- PTA基础编程题目集7-19 支票面额(15 分)
- Multiple Object Tracking Benchmark
- Mysql多表分页查询
- L1-048. 矩阵A乘以B
- Find All Numbers Disappeared in an Array(leetcode)
- [Lucas定理+中国剩余定理]1951—— [Sdoi2010]古代猪文
- 程序员必备的11个辅助开发的软件神器