请大神帮忙看下哪里错误了
package com.example.myapplication;
import android.app.Fragment;
import android.app.FragmentManager;
import android.app.FragmentTransaction;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.View;
import android.view.Window;
import android.widget.ImageButton;
import android.widget.LinearLayout;
public class MainActivity extends AppCompatActivity implements View.OnClickListener {
private LinearLayout mTabShouye;
private LinearLayout mTabXinxi;
private LinearLayout mTabGangwei;
private LinearLayout mTabWode;
private ImageButton mImageShouye;
private ImageButton mImageXinxi;
private ImageButton mImageGangwei;
private ImageButton mImageWode;
private Fragment mShouye;
private Fragment mGangwei;
private Fragment mXinxi;
private Fragment mWode;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
requestWindowFeature(Window.FEATURE_NO_TITLE);
setContentView(R.layout.activity_main);
initView();
initEvents();
setSelect(0);
}
private void initEvents() {
mTabShouye.setOnClickListener(this);
mTabGangwei.setOnClickListener(this);
mTabXinxi.setOnClickListener(this);
mImageWode.setOnClickListener(this);
}
private void initView() {
mTabShouye = (LinearLayout) findViewById(R.id.id_tab_shouye);
mTabXinxi= (LinearLayout) findViewById(R.id.id_tab_xinxi);
mTabGangwei = (LinearLayout) findViewById(R.id.id_tab_gangwei);
mTabWode = (LinearLayout) findViewById(R.id.id_tab_wode);
mImageShouye= (ImageButton) findViewById(R.id.id_tab_shouyeImage);
mImageGangwei= (ImageButton) findViewById(R.id.id_tab_gangweiImage);
mImageXinxi= (ImageButton) findViewById(R.id.id_tab_xinxiImage);
mImageWode= (ImageButton) findViewById(R.id.wodeImage);
}
private void setSelect(int i){
//把图片设置为亮的
//设置内容区域
FragmentManager fm = getFragmentManager();
FragmentTransaction ft= fm.beginTransaction();
hideFragment(ft);
switch (i){
case 0:
if (mShouye ==null){
mShouye = new First_Fragment();
ft.add(R.id.content,mShouye);
}else {
ft.show(mShouye);
}
mImageShouye.setImageResource(R.drawable.down05_1);
break;
case 1:
if (mGangwei ==null){
mGangwei = new SecondActivity();
ft.add(R.id.content,mGangwei);
}else {
ft.show(mGangwei);
}
mImageGangwei.setImageResource(R.drawable.down06_1);
break;
case 2:
if (mXinxi ==null){
mXinxi = new ThirdActivity();
ft.add(R.id.content,mXinxi);
}else {
ft.show(mXinxi);
}
mImageXinxi.setImageResource(R.drawable.down07_1);
break;
case 3:
if (mWode ==null){
mWode = new ForthActivity();
ft.add(R.id.content,mWode);
}else {
ft.show(mWode);
}
mImageWode.setImageResource(R.drawable.down08_1);
break;
default:
break;
}
ft.commit();//事件操作结束以后,提交
}
private void hideFragment(FragmentTransaction ft) {
if (mShouye != null){
ft.hide(mShouye);
}
if (mGangwei != null){
ft.hide(mGangwei);
}
if (mXinxi != null){
ft.hide(mXinxi);
}
if (mWode != null){
ft.hide(mWode);
}
}
@Override
public void onClick(View v) {
resetImages(); //重置图片
switch (v.getId()){ //获取点击id;
case R.id.id_tab_shouye:
setSelect(0);
break;
case R.id.id_tab_gangwei:
setSelect(1);
break;
case R.id.id_tab_xinxi:
setSelect(2);
break;
case R.id.id_tab_wode:
setSelect(3);
break;
}
}
private void resetImages() { //图片切换至暗色
mImageShouye.setImageResource(R.drawable.down05);
mImageGangwei.setImageResource(R.drawable.dowm06);
mImageXinxi.setImageResource(R.drawable.down07);
mImageWode.setImageResource(R.drawable.down08);
}
}