加计时器的网络获取工具类

package com.example.hello.myappyuekaolian2.mainactivity;

import android.content.Intent;
import android.os.Bundle;
import android.os.Handler;
import android.os.Message;
import android.support.v7.app.AppCompatActivity;
import android.view.Window;
import android.widget.TextView;

import com.example.hello.myappyuekaolian2.R;

import java.util.Timer;
import java.util.TimerTask;

public class MainActivity extends AppCompatActivity {
    private TextView item;
    int total=3;
    private Timer timer;
    @Override
    protected void onCreate(Bundle savedInstanceState) {

        super.onCreate(savedInstanceState);
        requestWindowFeature(Window.FEATURE_NO_TITLE);
        setContentView(R.layout.activity_main);

        item=(TextView)findViewById(R.id.itme);
        timer = new Timer();
        //使用timer进行计时
        timer.schedule(new TimerTask() {
            @Override
            public void run() {
                total--;
                //判断是否计时完成
                if(total==0){
                    gettomain();
                    handler.sendEmptyMessage(1);  //
                }else{
                    handler.sendEmptyMessage(2);
                }

            }
        }, 0, 1000);

    }

    Handler handler=new Handler(){

        public void handleMessage(Message msg) {
            //倒计时完成
            if(msg.what==0){
                gettomain();
                timer.cancel();
                total=3;
                item.setEnabled(true);

            }else{
                item.setEnabled(false);
                item.setText(total+"");  //9 8 7 6   0
            }

        };

    };

    public void gettomain(){
        Intent in=new Intent(MainActivity.this,Main2Activity.class);
        startActivity(in);
    }

}
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++
package com.example.hello.myappyuekaolian2.mainactivity;

import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.widget.RadioGroup;

import com.example.hello.myappyuekaolian2.R;
import com.example.hello.myappyuekaolian2.frment.Fragmenthome;
import com.example.hello.myappyuekaolian2.frment.Fragmenttext;
import com.example.hello.myappyuekaolian2.frment.Fragmentuser;

public class Main2Activity extends AppCompatActivity {
    private RadioGroup radioGroup;
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main2);
        radioGroup = (RadioGroup) findViewById(R.id.radio_group);

        //默认显示
        getSupportFragmentManager().beginTransaction().replace(R.id.frame_layout,new Fragmenthome()).commit();

        radioGroup.setOnCheckedChangeListener(new RadioGroup.OnCheckedChangeListener() {
            @Override
            public void onCheckedChanged(RadioGroup radioGroup, int i) {
                switch (i){
                    case R.id.rb1:
                        getSupportFragmentManager().beginTransaction().replace(R.id.frame_layout,new Fragmenthome()).commit();
                        break;
                    case R.id.rb2:
                        getSupportFragmentManager().beginTransaction().replace(R.id.frame_layout,new Fragmenttext()).commit();
                        break;
                    case R.id.rb3:
                        getSupportFragmentManager().beginTransaction().replace(R.id.frame_layout,new Fragmentuser()).commit();
                        break;

                    default:
                        break;
                }
            }
        });
    }


}
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
package com.example.hello.myappyuekaolian2.frment;

import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.design.widget.TabLayout;
import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentPagerAdapter;
import android.support.v4.view.ViewPager;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;

import com.example.hello.myappyuekaolian2.R;

import java.util.ArrayList;
import java.util.List;

/**
 * Created by on 2017/10/16.
 */

public class Fragmenthome extends Fragment{
    private TabLayout tabLayout;
    private ViewPager viewPager;
    private List<String> list;
    @Nullable
    @Override
    public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
        View view = inflater.inflate(R.layout.home,container,false);
        tabLayout = view.findViewById(R.id.tab);
        viewPager =view.findViewById(R.id.view_pager);
        return view;
    }

    @Override
    public void onActivityCreated(@Nullable Bundle savedInstanceState) {
        super.onActivityCreated(savedInstanceState);
        list = new ArrayList<>();
        list.add("推荐");
        list.add("热点");
        list.add("北京");
        list.add("视频");
        list.add("社会");
        list.add("图片");


        //设置适配器
        viewPager.setAdapter(new FragmentPagerAdapter(getChildFragmentManager()) {
            @Override
            public CharSequence getPageTitle(int position) {

                return list.get(position);
            }

            @Override
            public Fragment getItem(int position) {
                Fragment fragment = null;

                switch (position) {
                    case 0:
                        fragment = new Fragmenttuijian();
                        break;
                    case 1:
                        fragment = new Fragmentredian();
                        break;
                    case 2:
                        fragment = new Fragmentbeijing();
                        break;
                    case 3:
                        fragment = new Fragmentshipin();
                        break;
                    case 4:
                        fragment = new Fragmentshehui();
                        break;
                    case 5:
                        fragment = new Fragmenttupian();
                        break;
                    default:
                        break;
                }

                return fragment;
            }

            @Override
            public int getCount() {
                
                return list.size();
            }
        });

        //关联
        tabLayout.setupWithViewPager(viewPager);
    }



}
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
package com.example.hello.myappyuekaolian2.frment;

import android.os.Bundle;
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.hello.myappyuekaolian2.R;
import com.example.hello.myappyuekaolian2.adapert.MyAdapter;
import com.example.hello.myappyuekaolian2.bean.DataDataBean;
import com.example.hello.myappyuekaolian2.util.JsonStringCallaBack;
import com.example.hello.myappyuekaolian2.util.NetDataUtil;
import com.example.hello.myappyuekaolian2.view.XListView;
import com.google.gson.Gson;

import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;

/**
 * Created by  on 2017/10/16.
 */

public class Fragmenttuijian extends Fragment implements XListView.IXListViewListener{
    private XListView xListView;
    private List<DataDataBean.ResultsBean> list = new ArrayList<>();
    private MyAdapter myAdapter;
    private int page_num = 1;
    @Nullable
    @Override
    public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
        View view = inflater.inflate(R.layout.tuijian_view,container,false);
        xListView = view.findViewById(R.id.xlv);
        return view;
    }

    @Override
    public void onActivityCreated(@Nullable Bundle savedInstanceState) {
        super.onActivityCreated(savedInstanceState);
        xListView.setPullLoadEnable(true);
        xListView.setPullLoadEnable(true);
        xListView.setXListViewListener(this);

        //获取数据....解析
        getDataFromNet();
    }
    /**
     * 获取网络数据.....添加到后面,用于最开始和上拉加载更多
     */
    private void getDataFromNet() {

        NetDataUtil.getData(getActivity(), "http://gank.io/api/data/Android/10/" + page_num, new JsonStringCallaBack() {
            @Override
            public void getJsonString(String json) {
                //在这里解析
                Gson gson = new Gson();

                DataDataBean dataDataBean = gson.fromJson(json, DataDataBean.class);

                list.addAll(dataDataBean.getResults());

                //设置适配器
                setAdapter();

                //停止加载
                xListView.stopLoadMore();
            }
        });
    }

    private void setAdapter() {
        if (myAdapter == null) {

            myAdapter = new MyAdapter(getActivity(), list);
            xListView.setAdapter(myAdapter);
        } else {
            myAdapter.notifyDataSetChanged();
        }
    }

    @Override
    public void onRefresh() {
        getDataRefresh();
    }

    /**
     * 下拉刷新数据的方法
     */
    private void getDataRefresh() {
        //当列表下拉刷新时,接口的页数设置为1,清除原来的列表数据,请求网络

        NetDataUtil.getData(getActivity(), "http://gank.io/api/data/Android/10/1", new JsonStringCallaBack() {
            @Override
            public void getJsonString(String json) {
                //在这里解析
                Gson gson = new Gson();

                DataDataBean dataDataBean = gson.fromJson(json, DataDataBean.class);
                //先清除所有
                list.clear();
                //再添加
                list.addAll(0, dataDataBean.getResults());

                //设置适配器
                setAdapter();

                //停止刷新
                xListView.stopRefresh();
                //设置刷新时间
                String format = new SimpleDateFormat("HH:mm").format(new Date(System.currentTimeMillis()));
                xListView.setRefreshTime(format);
            }
        });
    }

    @Override
    public void onLoadMore() {
        page_num++;
        getDataFromNet();
    }

}
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
package com.example.hello.myappyuekaolian2.frment;

import android.os.Bundle;
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.hello.myappyuekaolian2.R;

/**
 * Created by  on 2017/10/16.
 */

public class Fragmenttext extends Fragment{
    @Nullable
    @Override
    public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
        View view = inflater.inflate(R.layout.totext,container,false);

        return view;
    }

    @Override
    public void onActivityCreated(@Nullable Bundle savedInstanceState) {
        super.onActivityCreated(savedInstanceState);
    }

}
++++++++++++++++++++++++++++++++++++++++++++++++++++++++
package com.example.hello.myappyuekaolian2.adapert;

import android.content.Context;
import android.util.Log;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.ImageView;
import android.widget.TextView;

import com.example.hello.myappyuekaolian2.R;
import com.example.hello.myappyuekaolian2.bean.DataDataBean;
import com.example.hello.myappyuekaolian2.util.ImageLoaderUtil;
import com.nostra13.universalimageloader.core.ImageLoader;

import java.util.List;

/**
 * Created by  on 2017/10/16.
 */

public class MyAdapter extends BaseAdapter {
    Context context;
    List<DataDataBean.ResultsBean> list;
    private int TEXT_ONLY = 0;
    private int IMAGE_TEXT = 1;

    public MyAdapter(Context context, List<DataDataBean.ResultsBean> list) {
        this.context = context;
        this.list = list;
    }

    @Override
    public int getCount() {
        return list.size();
    }

    @Override
    public Object getItem(int i) {
        return list.get(i);
    }

    @Override
    public long getItemId(int i) {
        return i;
    }

    @Override
    public int getViewTypeCount() {
        return 2;
    }

    @Override
    public int getItemViewType(int position) {
        if (list.get(position).getImages() != null){
            return IMAGE_TEXT;
        }

        return TEXT_ONLY;
    }

    @Override
    public View getView(int i, View view, ViewGroup viewGroup) {
        if (getItemViewType(i) == TEXT_ONLY){
            TextHolder holder;
            if (view == null){
                view = View.inflate(context, R.layout.item_text_layout,null);
                holder = new TextHolder();

                holder.textView = view.findViewById(R.id.text_title);

                view.setTag(holder);

            }else {
                holder = (TextHolder) view.getTag();
            }

            holder.textView.setText(list.get(i).getDesc());

        }else if (getItemViewType(i)==IMAGE_TEXT){

            ImageHolder holder;
            if (view == null){
                view = View.inflate(context, R.layout.item_iamge_layout,null);
                holder = new ImageHolder();

                holder.textView = view.findViewById(R.id.text_title);
                holder.imageView = view.findViewById(R.id.image_view);

                view.setTag(holder);

            }else {
                holder = (ImageHolder) view.getTag();
            }

            holder.textView.setText(list.get(i).getDesc());
            //图片
            Log.i("----",list.get(i).getImages().get(0)+"?imageView2/0/w/100");
            ImageLoader.getInstance().displayImage(list.get(i).getImages().get(0)+"?imageView2/0/w/100",holder.imageView, ImageLoaderUtil.gettupianyuanjiao());
        }

        return view;
    }

    private class TextHolder{
        TextView textView;
    }

    private class ImageHolder{
        TextView textView;
        ImageView imageView;
    }
}
+++++++++++++++++++++++++++++++++++++++++
package com.example.hello.myappyuekaolian2.appliction;

import android.app.Application;

import com.example.hello.myappyuekaolian2.util.ImageLoaderUtil;


/**
 * Created by on 2017/10/16.
 */

public class BaseApplication extends Application {
    @Override
    public void onCreate() {
        super.onCreate();
        ImageLoaderUtil.init(this);
    }
}
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
package com.example.hello.myappyuekaolian2.util;

import android.content.Context;
import android.os.AsyncTask;
import android.widget.Toast;

import java.io.BufferedReader;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.net.HttpURLConnection;
import java.net.URL;

/**
 * Created by on 2017/10/16.
 */

public class NetDataUtil {
    public static void getData(Context context, final String path, final JsonStringCallaBack callaBack) {
        if (NetWorkUtil.isConn(context)){
            Toast.makeText(context,"网络可用",Toast.LENGTH_SHORT).show();

            AsyncTask<Void, Void, String> asyncTask = new AsyncTask<Void, Void, String>() {
                @Override
                protected String doInBackground(Void... voids) {
                    try {
                        URL url = new URL(path);

                        HttpURLConnection connection = (HttpURLConnection) url.openConnection();

                        connection.setRequestMethod("GET");
                        connection.setReadTimeout(5000);
                        connection.setConnectTimeout(5000);

                        int responseCode = connection.getResponseCode();
                        if (responseCode == 200){
                            InputStream inputStream = connection.getInputStream();

                            String json = streamToString(inputStream,"utf-8");

                            return json;
                        }

                    } catch (Exception e) {
                        e.printStackTrace();
                    }

                    return null;
                }

                @Override
                protected void onPostExecute(String json) {
                    //异步拿回这个json串,交给具体解析的那个类
                    callaBack.getJsonString(json);
                }
            };

            asyncTask.execute();
        }else {
            NetWorkUtil.showNoNetWorkDlg(context);
        }


    }


    private static String streamToString(InputStream inputStream, String charset) {
        try {
            InputStreamReader inputStreamReader = new InputStreamReader(inputStream,charset);

            BufferedReader bufferedReader = new BufferedReader(inputStreamReader);
            String s = null;
            StringBuilder builder = new StringBuilder();
            while ((s = bufferedReader.readLine()) != null){
                builder.append(s);
            }

            bufferedReader.close();
            return builder.toString();

        } catch (Exception e) {
            e.printStackTrace();
        }

        return  null;
    }
}
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
package com.example.hello.myappyuekaolian2.util;

import android.app.AlertDialog;
import android.content.Context;
import android.content.DialogInterface;
import android.content.Intent;
import android.net.ConnectivityManager;
import android.net.NetworkInfo;

import com.example.hello.myappyuekaolian2.R;


/**
 * Created by 韦作铭 on 2017/10/16.
 */

public class NetWorkUtil {
    public static boolean isConn(Context context){
        boolean bisConnFlag=false;
        ConnectivityManager conManager = (ConnectivityManager)context.getSystemService(Context.CONNECTIVITY_SERVICE);
        NetworkInfo network = conManager.getActiveNetworkInfo();
        if(network!=null){
            bisConnFlag=conManager.getActiveNetworkInfo().isAvailable();
        }
        return bisConnFlag;
    }

    /**
     * 当判断当前手机没有网络时选择是否打开网络设置
     * @param context
     */
    public static void showNoNetWorkDlg(final Context context) {
        AlertDialog.Builder builder = new AlertDialog.Builder(context);
        builder.setIcon(R.mipmap.ic_launcher)         //
                .setTitle(R.string.app_name)            //
                .setMessage("当前无网络").setPositiveButton("设置",new DialogInterface.OnClickListener(){

            @Override
            public void onClick(DialogInterface dialog, int which) {
                // 跳转到系统的网络设置界面
                Intent intent = null;
                // 先判断当前系统版本
                if(android.os.Build.VERSION.SDK_INT > 10){  // 3.0以上
                    intent = new Intent(android.provider.Settings.ACTION_WIRELESS_SETTINGS);
                }else{
                    intent = new Intent();
                    intent.setClassName("com.android.settings", "com.android.settings.WirelessSettings");
                }
                context.startActivity(intent);

            }
        }).setNegativeButton("知道了", null).show();
    }
}
package com.example.hello.myappyuekaolian2.util;

import android.app.AlertDialog;
import android.content.Context;
import android.content.DialogInterface;
import android.content.Intent;
import android.net.ConnectivityManager;
import android.net.NetworkInfo;

import com.example.hello.myappyuekaolian2.R;


/**
 * Created by on 2017/10/16.
 */

public class NetWorkUtil {
    public static boolean isConn(Context context){
        boolean bisConnFlag=false;
        ConnectivityManager conManager = (ConnectivityManager)context.getSystemService(Context.CONNECTIVITY_SERVICE);
        NetworkInfo network = conManager.getActiveNetworkInfo();
        if(network!=null){
            bisConnFlag=conManager.getActiveNetworkInfo().isAvailable();
        }
        return bisConnFlag;
    }

    /**
     * 当判断当前手机没有网络时选择是否打开网络设置
     * @param context
     */
    public static void showNoNetWorkDlg(final Context context) {
        AlertDialog.Builder builder = new AlertDialog.Builder(context);
        builder.setIcon(R.mipmap.ic_launcher)         //
                .setTitle(R.string.app_name)            //
                .setMessage("当前无网络").setPositiveButton("设置",new DialogInterface.OnClickListener(){

            @Override
            public void onClick(DialogInterface dialog, int which) {
                // 跳转到系统的网络设置界面
                Intent intent = null;
                // 先判断当前系统版本
                if(android.os.Build.VERSION.SDK_INT > 10){  // 3.0以上
                    intent = new Intent(android.provider.Settings.ACTION_WIRELESS_SETTINGS);
                }else{
                    intent = new Intent();
                    intent.setClassName("com.android.settings", "com.android.settings.WirelessSettings");
                }
                context.startActivity(intent);

            }
        }).setNegativeButton("知道了", null).show();
    }
}
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++
package com.example.hello.myappyuekaolian2.util;

/**
 * Created by on 2017/10/16.
 */

public interface JsonStringCallaBack {
    public void getJsonString(String json);
}
+++++++++++++++++++++++++++++++++++++++
package com.example.hello.myappyuekaolian2.util;

import android.content.Context;
import android.graphics.Bitmap;

import com.example.hello.myappyuekaolian2.R;
import com.nostra13.universalimageloader.cache.disc.impl.UnlimitedDiskCache;
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.RoundedBitmapDisplayer;
import com.nostra13.universalimageloader.utils.StorageUtils;

import java.io.File;

/**
 * Created by on 2017/10/16.
 */

public class ImageLoaderUtil {
    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())加密

                .defaultDisplayImageOptions(DisplayImageOptions.createSimple()) // default
                .writeDebugLogs() // 打印debug log
                .build(); //开始构建
        ImageLoader.getInstance().init(config);
    }
    public static DisplayImageOptions gettupianyuanjiao(){
        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.EXACTLY_STRETCHED) // default 设置图片以如何的编码方式显示
                .bitmapConfig(Bitmap.Config.RGB_565) // default 设置图片的解码类型

        .displayer(new RoundedBitmapDisplayer(10)) // default  还可以设置圆角图片new RoundedBitmapDisplayer(20)

                .build();
        return options;
    }

}
+++++++++++++++++++++++++++++++++++++++++++++++++++++
main1
<?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"
    android:background="@drawable/splash"
    xmlns:tools="http://schemas.android.com/tools"
    android:orientation="vertical"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    tools:context="com.example.hello.myappyuekaolian2.mainactivity.MainActivity">
    <!--horizontal-->

    <TextView
        android:id="@+id/itme"
        android:textColor="#fff"
        android:layout_width="wrap_content"
        android:paddingTop="8dp"
        android:paddingRight="23dp"
        android:textSize="30dp"
        android:layout_gravity="right"
        android:layout_height="wrap_content"
        android:text="3"  />

</LinearLayout>
+++++++++++++++++++++++++++++++++++++++++++++
main2
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout
    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="com.example.hello.myappyuekaolian2.mainactivity.Main2Activity">
    <FrameLayout
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:id="@+id/frame_layout"
        android:layout_above="@+id/radio_group"
        >

    </FrameLayout>
    <RadioGroup
        android:id="@+id/radio_group"
        android:layout_alignParentBottom="true"
        android:orientation="horizontal"
        android:layout_width="match_parent"
        android:layout_height="40dp"
        >
        <RadioButton
            android:id="@+id/rb1"
            android:button="@null"

            android:gravity="center"
            android:clickable="true"
            android:padding="10dp"
            android:background="@drawable/radio_selector"
            android:layout_width="wrap_content"
            android:layout_weight="1"
            android:layout_height="match_parent" />
        <RadioButton
            android:id="@+id/rb2"
            android:button="@null"

            android:gravity="center"
            android:clickable="true"
            android:padding="10dp"
            android:background="@drawable/radio_selector2"
            android:layout_width="wrap_content"
            android:layout_weight="1"
            android:layout_height="match_parent" />
        <RadioButton
            android:id="@+id/rb3"
            android:button="@null"

            android:gravity="center"
            android:clickable="true"
            android:padding="10dp"
            android:background="@drawable/radio_selector3"
            android:layout_width="wrap_content"
            android:layout_weight="1"
            android:layout_height="match_parent" />

    </RadioGroup>
</RelativeLayout>
+++++++++++++++++++++++++++++++++++++++++++++
home
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
    xmlns:android="http://schemas.android.com/apk/res/android"
    android:orientation="vertical"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    android:layout_width="match_parent"
    android:layout_height="match_parent">
    <LinearLayout
        android:orientation="horizontal"
        android:background="#d43d3d"
        android:layout_width="match_parent"
        android:layout_height="wrap_content">
        <TextView
            android:text="今日头条"
            android:textSize="25dp"
            android:textColor="#fff"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content" />
        <EditText
            android:background="#f6f5f4"
            android:hint="在线泡水|两个萌娃|荒岛惊魂"
            android:padding="10dp"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_marginRight="20dp"

            />
    </LinearLayout>


    <android.support.design.widget.TabLayout
        android:id="@+id/tab"
        app:tabGravity="center"
        app:tabIndicatorColor="@color/colorAccent"
        app:tabMode="scrollable"
        app:tabSelectedTextColor="@color/colorPrimaryDark"
        app:tabTextColor="@color/colorPrimary"
        android:layout_width="match_parent"
        android:layout_height="40dp">

    </android.support.design.widget.TabLayout>

    <android.support.v4.view.ViewPager
        android:id="@+id/view_pager"
        android:layout_width="match_parent"
        android:layout_height="match_parent">

    </android.support.v4.view.ViewPager>
</LinearLayout>
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++
tuijian
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
    xmlns:android="http://schemas.android.com/apk/res/android"
    android:orientation="vertical"

    android:layout_width="match_parent"
    android:layout_height="match_parent">
    <com.example.hello.myappyuekaolian2.view.XListView
        android:id="@+id/xlv"
        android:layout_width="match_parent"
        android:layout_height="match_parent">

    </com.example.hello.myappyuekaolian2.view.XListView>
</LinearLayout>
++++++++++++++++++++++++++++++++++++++++++++++++
user
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
    xmlns:android="http://schemas.android.com/apk/res/android"
    android:orientation="vertical"
    android:background="#87ea39"
    android:layout_width="match_parent"
    android:layout_height="match_parent">

</LinearLayout>

+++++++++++++++++++++++++++++++++++++++
item_image_layout
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:orientation="horizontal"
    android:padding="10dp"
    android:layout_width="match_parent"
    android:layout_height="match_parent">

    <TextView
        android:id="@+id/text_title"
        android:layout_width="0dp"
        android:layout_weight="1"
        android:layout_height="wrap_content" />

    <ImageView
        android:id="@+id/image_view"
        android:layout_width="100dp"
        android:layout_height="100dp" />

</LinearLayout>

+++++++++++++++++++++++++++++++++++++++++++++++++++++++
权限
<uses-permission android:name="android.permission.INTERNET"/>
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE"/>
















 
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值