//原因:findviewbyid结果为空
//MainActivity.java
package com.example.dell.viewpage;
import android.content.ContentValues;
import android.content.Context;
import android.content.res.Resources;
import android.database.Cursor;
import android.database.sqlite.SQLiteDatabase;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.graphics.drawable.BitmapDrawable;
import android.graphics.drawable.Drawable;
import android.net.Uri;
import android.support.annotation.DrawableRes;
import android.support.v4.content.ContextCompat;
import android.support.v4.view.PagerAdapter;
import android.support.v4.view.ViewPager;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.view.Window;
import android.view.WindowManager;
import android.widget.ImageButton;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.TextView;
import com.google.android.gms.appindexing.Action;
import com.google.android.gms.appindexing.AppIndex;
import com.google.android.gms.appindexing.Thing;
import com.google.android.gms.common.api.GoogleApiClient;
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.util.ArrayList;
import java.util.List;
public class MainActivity extends AppCompatActivity implements View.OnClickListener {
static final String db_name = "testDB";
//static final String tb_name = "clothes";
static final String tb_name = "express";
SQLiteDatabase db;
//声明ViewPager
private ViewPager mViewpager;
//声明四个Tab
private LinearLayout mTabHome;
private LinearLayout mTabTuijian;
private LinearLayout mTabManage;
private LinearLayout mTabYigui;
//声明四个ImageButton
private ImageButton mWeixinImg;
private ImageButton mFrdImg;
private ImageButton mAddressImg;
private ImageButton mSettingImg;
//声明ViewPager的适配器
private PagerAdapter mAdpater;
//用于装载四个Tab的List
private List<View> mTabs = new ArrayList<View>();
/**
* ATTENTION: This was auto-generated to implement the App Indexing API.
* See https://g.co/AppIndexing/AndroidStudio for more information.
*/
View tab2,tab4;
Drawable drawable;
private GoogleApiClient client;
/**
* <style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar">
<!-- Customize your theme here. -->
<item name="colorPrimary">@color/colorPrimary</item>
<item name="colorPrimaryDark">@color/colorPrimaryDark</item>
<item name="colorAccent">@color/colorAccent</item>
</style>
* @param savedInstanceState
*/
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
//去掉TitleBar
this.requestWindowFeature(Window.FEATURE_NO_TITLE);
//去掉Activity上面的状态栏
///getWindow().setFlags(WindowManager.LayoutParams. FLAG_FULLSCREEN , WindowManager.LayoutParams. FLAG_FULLSCREEN);
// requestWindowFeature();的取值
// 1.DEFAULT_FEATURES:系统默认状态,一般不需要指定
// 2.FEATURE_CONTEXT_MENU:启用ContextMenu,默认该项已启用,一般无需指定
// 3.FEATURE_CUSTOM_TITLE:自定义标题。当需要自定义标题时必须指定。如:标题是一个按钮时
// 4.FEATURE_INDETERMINATE_PROGRESS:不确定的进度
// 5.FEATURE_LEFT_ICON:标题栏左侧的图标
// 6.FEATURE_NO_TITLE:无标题
// 7.FEATURE_OPTIONS_PANEL:启用“选项面板”功能,默认已启用。
// 8.FEATURE_PROGRESS:进度指示器功能
// 9.FEATURE_RIGHT_ICON:标题栏右侧的图标
setContentView(R.layout.activity_main);
initViews();//初始化控件
initDatas();//初始化数据
initEvents();//初始化事件
try{
db = openOrCreateDatabase(db_name, Context.MODE_PRIVATE,null);
///String sql = "Create table if not exists " + tb_name + "(NO Integer PRIMARY KEY AUTOINCREMENT,cloth_ID varchar(10) PRIMARY KEY,cloth_Name TEXT,cloth_picture BLOB,cloth_position TEXT,source TEXT,addDate TEXT,heatlevel Integer,categoryID varchar(10),price REAL,likelevel Integer,dropDate TEXT,clean_way Integer,status Integer)";
///db.execSQL(sql);
db.execSQL("Create table if not exists " + tb_name + " ( _id INTEGER PRIMARY KEY AUTOINCREMENT,express_no varchar(100),express_name TEXT,express_img BLOB );");
//Bitmap变为Blob
ContentValues values = new ContentValues();
final ByteArrayOutputStream os = new ByteArrayOutputStream();
Resources res = getResources();
Bitmap bmp = BitmapFactory.decodeResource(res,R.drawable.picture1); //BitmapFactory.decodeFile("/drawable/picture.jpg");
bmp.compress(Bitmap.CompressFormat.PNG, 100, os);
///System.out.println(os);
/*
values.put("cloth_picture",os.toByteArray());
values.put("cloth_ID","4176254633");
values.put("cloth_Name","帅气的大衣服");
values.put("cloth_position","衣柜1");
values.put("source","淘宝");
values.put("heatlevel","4");
values.put("categoryID","1111121");
values.put("price","99.99");
values.put("status","0");
values.put("categoryID","44567893");
values.put("like_level","2");
values.put("clean_way","1");
values.put("addDate","2017-01-19");
values.put("dropDate","2018-01-19");
*/
/// String sql = "select * from " + tb_name + ";";
/// Cursor cur = db.rawQuery(sql,null);
/// System.out.println(cur.getString(cur.getColumnIndex("express_name")));
///if(cur.moveToFirst()){
System.out.println("空空--");
///db.insert("cloths",null,values);
///cur = db.rawQuery(sql,null);
/// }
/*
values.put("express_img", os.toByteArray());
values.put("express_name","zf");
values.put("express_no","zf");
db.insert("express",null,values);//getContentResolver().insert("express", values);
*/
//从SQLite中读取Bitmap
Cursor cur = db.rawQuery("select * from express;",null);
if(cur.moveToLast()){
byte[] in=cur.getBlob(cur.getColumnIndex("express_img"));
Bitmap bmpout=BitmapFactory.decodeByteArray(in,0,in.length);
//显示在ImageView上
///ImageView imageView;
///System.out.println(imageView = (ImageView) findViewById(R.id.img));
ByteArrayInputStream stream = new ByteArrayInputStream(cur.getBlob(cur.getColumnIndex("express_img")));
drawable = Drawable.createFromStream(stream,null);
ImageView imageView;
imageView = (ImageView)(tab2.findViewById(R.id.img));
imageView.setImageDrawable(drawable);
///imageView.setImageDrawable(drawable);
/// ViewGroup group = (ViewGroup)tab4.findViewById(R.id.viewGroup);
/**
ImageView[] imageViews = new ImageView[1];
for(int i=0;i<1;i++){
ImageView imageView1 = new ImageView(this);
imageView1.setLayoutParams(new LinearLayout.LayoutParams(LinearLayout.LayoutParams.WRAP_CONTENT, LinearLayout.LayoutParams.WRAP_CONTENT));
imageViews[i] = imageView1;
imageView1.setImageDrawable(drawable);
group.addView(imageView);
}
*/
TextView t = ((TextView)tab4.findViewById(R.id.tab4_text));
t.setText(cur.getString(3));
}
cur.close();
}
catch(Exception ex){
System.out.println(ex.getMessage());
}
finally{
db.close();
}
// ATTENTION: This was auto-generated to implement the App Indexing API.
// See https://g.co/AppIndexing/AndroidStudio for more information.
client = new GoogleApiClient.Builder(this).addApi(AppIndex.API).build();
}
private void initEvents() {
//设置四个Tab的点击事件
mTabHome.setOnClickListener(this);
mTabTuijian.setOnClickListener(this);
mTabManage.setOnClickListener(this);
mTabYigui.setOnClickListener(this);
//添加ViewPager的切换Tab的监听事件
mViewpager.addOnPageChangeListener(new ViewPager.OnPageChangeListener() {
@Override
public void onPageScrolled(int position, float positionOffset, int positionOffsetPixels) {
}
@Override
public void onPageSelected(int position) {
//获取ViewPager的当前Tab
int currentItem = mViewpager.getCurrentItem();
//将所以的ImageButton设置成暗淡
resetImgs();
//将当前Tab对应的ImageButton设置成鲜亮
switch (currentItem) {
case 0:
mWeixinImg.setImageResource(R.mipmap.tab_home_pressed);
break;
case 1:
mFrdImg.setImageResource(R.mipmap.tab_tuijian_pressed);
break;
case 2:
mAddressImg.setImageResource(R.mipmap.tab_manage_pressed);
break;
case 3:
mSettingImg.setImageResource(R.mipmap.tab_yigui_pressed);
break;
}
}
@Override
public void onPageScrollStateChanged(int state) {
}
});
}
private void initDatas() {
//初始化ViewPager的适配器
mAdpater = new PagerAdapter() {
@Override
public int getCount() {
return mTabs.size();
}
@Override
public boolean isViewFromObject(View view, Object object) {
return view == object;
}
@Override
public Object instantiateItem(ViewGroup container, int position) {
View view = mTabs.get(position);
container.addView(view);
return view;
}
@Override
public void destroyItem(ViewGroup container, int position, Object object) {
container.removeView(mTabs.get(position));
}
};
//设置ViewPager的适配器
mViewpager.setAdapter(mAdpater);
}
//初始化控件
private void initViews() {
mViewpager = (ViewPager) findViewById(R.id.id_viewpager);
mTabHome = (LinearLayout) findViewById(R.id.id_tab_home);
mTabTuijian = (LinearLayout) findViewById(R.id.id_tab_tuijian);
mTabManage = (LinearLayout) findViewById(R.id.id_tab_manage);
mTabYigui = (LinearLayout) findViewById(R.id.id_tab_yigui);
mWeixinImg = (ImageButton) findViewById(R.id.id_tab_home_img);
mFrdImg = (ImageButton) findViewById(R.id.id_tab_tuijian_img);
mAddressImg = (ImageButton) findViewById(R.id.id_tab_manage_img);
mSettingImg = (ImageButton) findViewById(R.id.id_tab_yigui_img);
//获取到四个Tab
LayoutInflater inflater = LayoutInflater.from(this);
View tab1 = inflater.inflate(R.layout.tab1, null);
tab2 = inflater.inflate(R.layout.tab2, null);
View tab3 = inflater.inflate(R.layout.tab3, null);
tab4 = inflater.inflate(R.layout.tab4, null);
//将四个Tab添加到集合中
mTabs.add(tab1);
mTabs.add(tab2);
mTabs.add(tab3);
mTabs.add(tab4);
}
@Override
public void onClick(View v) {
//先将四个ImageButton都设置成灰色
resetImgs();
switch (v.getId()) {
case R.id.id_tab_home:
//设置viewPager的当前Tab
mViewpager.setCurrentItem(0);
//将当前Tab对应的ImageButton设置成绿色
mWeixinImg.setImageResource(R.mipmap.tab_home_pressed);
break;
case R.id.id_tab_tuijian:
mViewpager.setCurrentItem(1);
mFrdImg.setImageResource(R.mipmap.tab_tuijian_pressed);
break;
case R.id.id_tab_manage:
mViewpager.setCurrentItem(2);
mAddressImg.setImageResource(R.mipmap.tab_manage_pressed);
break;
case R.id.id_tab_yigui:
mViewpager.setCurrentItem(3);
mSettingImg.setImageResource(R.mipmap.tab_yigui_pressed);
break;
}
}
//将四个ImageButton设置成灰色
private void resetImgs() {
mWeixinImg.setImageResource(R.mipmap.tab_home_normal);
mFrdImg.setImageResource(R.mipmap.tab_tuijian_normal);
mAddressImg.setImageResource(R.mipmap.tab_manage_normal);
mSettingImg.setImageResource(R.mipmap.tab_yigui_normal);
}
/**
* ATTENTION: This was auto-generated to implement the App Indexing API.
* See https://g.co/AppIndexing/AndroidStudio for more information.
*/
public Action getIndexApiAction() {
Thing object = new Thing.Builder()
.setName("Main Page") // TODO: Define a title for the content shown.
// TODO: Make sure this auto-generated URL is correct.
.setUrl(Uri.parse("http://[ENTER-YOUR-URL-HERE]"))
.build();
return new Action.Builder(Action.TYPE_VIEW)
.setObject(object)
.setActionStatus(Action.STATUS_TYPE_COMPLETED)
.build();
}
@Override
public void onStart() {
super.onStart();
ImageView imageView;
// 加载图片
System.out.println(imageView = (ImageView)(findViewById(R.id.img)));
///
// ATTENTION: This was auto-generated to implement the App Indexing API.
// See https://g.co/AppIndexing/AndroidStudio for more information.
client.connect();
AppIndex.AppIndexApi.start(client, getIndexApiAction());
}
@Override
public void onStop() {
super.onStop();
// ATTENTION: This was auto-generated to implement the App Indexing API.
// See https://g.co/AppIndexing/AndroidStudio for more information.
AppIndex.AppIndexApi.end(client, getIndexApiAction());
client.disconnect();
}
}
--------------------------------------------activity_main.xml------------------------------------------------------------------------------------ <?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">
<include layout="@layout/top"/>
<android.support.v4.view.ViewPager
android:id="@+id/id_viewpager"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1">
</android.support.v4.view.ViewPager>
<include layout="@layout/bottom"/>
</LinearLayout>
---------------------------------------------------top.xml------------------------------------------------------------------------
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:background="@android:drawable/title_bar"
android:gravity="center"
android:layout_width="match_parent"
android:layout_height="45dp">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Personnal衣管家"
android:textColor="#ffffff"
android:textSize="20sp"
android:textStyle="bold"/>
</LinearLayout>
--------------------------------------------bottom.xml------------------------------------------------------------
<?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="55dp"
android:gravity="center"
android:background="@color/material_blue_grey_800"
android:orientation="horizontal">
<LinearLayout
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:id="@+id/id_tab_home"
android:gravity="center"
android:orientation="vertical">
<ImageButton
android:id="@+id/id_tab_home_img"
android:clickable="false"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@mipmap/tab_home_pressed"
android:background="#00000000"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="#ffffff"
android:text="首页"/>
</LinearLayout>
<LinearLayout
android:id="@+id/id_tab_tuijian"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:gravity="center"
android:orientation="vertical">
<ImageButton
android:id="@+id/id_tab_tuijian_img"
android:clickable="false"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@mipmap/tab_tuijian_normal"
android:background="#00000000"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="#ffffff"
android:text="推荐"/>
</LinearLayout>
<LinearLayout
android:id="@+id/id_tab_manage"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:gravity="center"
android:orientation="vertical">
<ImageButton
android:id="@+id/id_tab_manage_img"
android:clickable="false"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@mipmap/tab_manage_normal"
android:background="#00000000"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="#ffffff"
android:text="管理"/>
</LinearLayout>
<LinearLayout
android:id="@+id/id_tab_yigui"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:gravity="center"
android:orientation="vertical">
<ImageButton
android:id="@+id/id_tab_yigui_img"
android:clickable="false"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@mipmap/tab_yigui_normal"
android:background="#00000000"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="#ffffff"
android:text="我的衣柜"/>
</LinearLayout>
</LinearLayout>
-----------------------------------------------tab1.xml-------------------------------------------------------------------
<?xml version="1.0" encoding="utf-8"?>
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fillViewport="false">
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent">
<ImageView
android:layout_width="match_parent"
android:layout_height="281dp"
app:srcCompat="@drawable/picture1"
android:id="@+id/imageView" />
<TextView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:id="@+id/txt"
android:gravity="center"
android:textSize="15sp"
android:text="小贴士"/>
<TextView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:gravity="left"
android:textSize="10sp"
android:text="\u3000\u3000洗好的衬衣最好用衣架挂起来,如果家里挂衣服的位置不够,把衬衣叠起来保存也不失为一个好办法。可是想要把衬衫叠得整齐可不容易,下面小编为大家介衬衣怎么叠,衬衣的叠法图解教程。 一、开领短袖衬衫怎么叠,开领短袖衬衫的叠法 二、长袖衬衣怎么叠,长袖衬衣的叠法图解教程 "/>
<TextView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:gravity="left"
android:textSize="10sp"
android:text="\u3000\u3000洗好的衬衣最好用衣架挂起来,如果家里挂衣服的位置不够,把衬衣叠起来保存也不失为一个好办法。可是想要把衬衫叠得整齐可不容易,下面小编为大家介衬衣怎么叠,衬衣的叠法图解教程。 一、开领短袖衬衫怎么叠,开领短袖衬衫的叠法 二、长袖衬衣怎么叠,长袖衬衣的叠法图解教程 "/>
<TextView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:gravity="left"
android:textSize="10sp"
android:text="\u3000\u3000洗好的衬衣最好用衣架挂起来,如果家里挂衣服的位置不够,把衬衣叠起来保存也不失为一个好办法。可是想要把衬衫叠得整齐可不容易,下面小编为大家介衬衣怎么叠,衬衣的叠法图解教程。 一、开领短袖衬衫怎么叠,开领短袖衬衫的叠法 二、长袖衬衣怎么叠,长袖衬衣的叠法图解教程 "/>
<TextView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:gravity="left"
android:textSize="10sp"
android:text="\u3000\u3000洗好的衬衣最好用衣架挂起来,如果家里挂衣服的位置不够,把衬衣叠起来保存也不失为一个好办法。可是想要把衬衫叠得整齐可不容易,下面小编为大家介衬衣怎么叠,衬衣的叠法图解教程。 一、开领短袖衬衫怎么叠,开领短袖衬衫的叠法 二、长袖衬衣怎么叠,长袖衬衣的叠法图解教程 "/>
<TextView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:gravity="left"
android:textSize="10sp"
android:text="\u3000\u3000洗好的衬衣最好用衣架挂起来,如果家里挂衣服的位置不够,把衬衣叠起来保存也不失为一个好办法。可是想要把衬衫叠得整齐可不容易,下面小编为大家介衬衣怎么叠,衬衣的叠法图解教程。 一、开领短袖衬衫怎么叠,开领短袖衬衫的叠法 二、长袖衬衣怎么叠,长袖衬衣的叠法图解教程 "/>
<TextView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:gravity="left"
android:textSize="10sp"
android:text="\u3000\u3000洗好的衬衣最好用衣架挂起来,如果家里挂衣服的位置不够,把衬衣叠起来保存也不失为一个好办法。可是想要把衬衫叠得整齐可不容易,下面小编为大家介衬衣怎么叠,衬衣的叠法图解教程。 一、开领短袖衬衫怎么叠,开领短袖衬衫的叠法 二、长袖衬衣怎么叠,长袖衬衣的叠法图解教程 "/>
<TextView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:gravity="left"
android:textSize="10sp"
android:text="\u3000\u3000洗好的衬衣最好用衣架挂起来,如果家里挂衣服的位置不够,把衬衣叠起来保存也不失为一个好办法。可是想要把衬衫叠得整齐可不容易,下面小编为大家介衬衣怎么叠,衬衣的叠法图解教程。 一、开领短袖衬衫怎么叠,开领短袖衬衫的叠法 二、长袖衬衣怎么叠,长袖衬衣的叠法图解教程 "/>
<TextView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:gravity="left"
android:textSize="10sp"
android:text="\u3000\u3000洗好的衬衣最好用衣架挂起来,如果家里挂衣服的位置不够,把衬衣叠起来保存也不失为一个好办法。可是想要把衬衫叠得整齐可不容易,下面小编为大家介衬衣怎么叠,衬衣的叠法图解教程。 一、开领短袖衬衫怎么叠,开领短袖衬衫的叠法 二、长袖衬衣怎么叠,长袖衬衣的叠法图解教程 "/>
<TextView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:gravity="left"
android:textSize="10sp"
android:text="\u3000\u3000洗好的衬衣最好用衣架挂起来,如果家里挂衣服的位置不够,把衬衣叠起来保存也不失为一个好办法。可是想要把衬衫叠得整齐可不容易,下面小编为大家介衬衣怎么叠,衬衣的叠法图解教程。 一、开领短袖衬衫怎么叠,开领短袖衬衫的叠法 二、长袖衬衣怎么叠,长袖衬衣的叠法图解教程 "/>
<TextView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:gravity="left"
android:textSize="10sp"
android:text="\u3000\u3000洗好的衬衣最好用衣架挂起来,如果家里挂衣服的位置不够,把衬衣叠起来保存也不失为一个好办法。可是想要把衬衫叠得整齐可不容易,下面小编为大家介衬衣怎么叠,衬衣的叠法图解教程。 一、开领短袖衬衫怎么叠,开领短袖衬衫的叠法 二、长袖衬衣怎么叠,长袖衬衣的叠法图解教程 "/>
<TextView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:gravity="left"
android:textSize="10sp"
android:text="\u3000\u3000洗好的衬衣最好用衣架挂起来,如果家里挂衣服的位置不够,把衬衣叠起来保存也不失为一个好办法。可是想要把衬衫叠得整齐可不容易,下面小编为大家介衬衣怎么叠,衬衣的叠法图解教程。 一、开领短袖衬衫怎么叠,开领短袖衬衫的叠法 二、长袖衬衣怎么叠,长袖衬衣的叠法图解教程 "/>
</LinearLayout>
</ScrollView>
----------------------------------------------tab2.xml---------------------------------------------------------------
<?xml version="1.0" encoding="utf-8"?>
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fillViewport="false">
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent">
<ImageView
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:srcCompat="@mipmap/clothes"
android:id="@+id/img" />
<TextView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:gravity="center"
android:textSize="30sp"
android:text="The 推荐 Tab!"/>
<TextView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:gravity="center"
android:textSize="30sp"
android:text="The 推荐 Tab!"/>
<TextView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:gravity="center"
android:textSize="30sp"
android:text="The 推荐 Tab!"/>
<TextView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:gravity="center"
android:textSize="30sp"
android:text="The 推荐 Tab!"/>
<TextView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:gravity="center"
android:textSize="30sp"
android:text="The 推荐 Tab!"/>
<TextView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:gravity="center"
android:textSize="30sp"
android:text="The 推荐 Tab!"/>
<TextView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:gravity="center"
android:textSize="30sp"
android:text="The 推荐 Tab!"/>
<TextView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:gravity="center"
android:textSize="30sp"
android:text="The 推荐 Tab!"/>
<TextView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:gravity="center"
android:textSize="30sp"
android:text="The 推荐 Tab!"/>
<TextView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:gravity="center"
android:textSize="30sp"
android:text="The 推荐 Tab!"/>
<TextView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:gravity="center"
android:textSize="30sp"
android:text="The 推荐 Tab!"/>
<TextView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:gravity="center"
android:textSize="30sp"
android:text="The 推荐 Tab!"/><TextView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:gravity="center"
android:textSize="30sp"
android:text="The 推荐 Tab!"/><TextView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:gravity="center"
android:textSize="30sp"
android:text="The 推荐 Tab!"/><TextView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:gravity="center"
android:textSize="30sp"
android:text="The 推荐 Tab!"/><TextView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:gravity="center"
android:textSize="30sp"
android:text="The 推荐 Tab!"/><TextView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:gravity="center"
android:textSize="30sp"
android:text="The 推荐 Tab!"/><TextView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:gravity="center"
android:textSize="30sp"
android:text="The 推荐 Tab!"/><TextView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:gravity="center"
android:textSize="30sp"
android:text="The 推荐 Tab!"/><TextView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:gravity="center"
android:textSize="30sp"
android:text="The 推荐 Tab!"/>
<TextView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:gravity="center"
android:textSize="30sp"
android:text="The 推荐 Tab!"/>
</LinearLayout>
</ScrollView>
------------------------------------------tab3.xml-------------------------------------------------------------------------
<?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">
<TextView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:gravity="center"
android:textSize="30sp"
android:text="我的衣柜 Tab!"/>
</LinearLayout>
-----------------------------------------tab4.xml---------------------------------------------------------------
<?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">
<TextView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:gravity="center"
android:textSize="30sp"
android:text="我的衣柜 Tab!"/>
</LinearLayout>