| | |
| | | package cn.com.basic.face.base; |
| | | |
| | | import android.content.Context; |
| | | import android.os.Handler; |
| | | import android.support.design.widget.TabLayout; |
| | | import android.support.v4.app.Fragment; |
| | | import android.support.v4.app.FragmentManager; |
| | |
| | | import android.view.Window; |
| | | import android.view.WindowManager; |
| | | import android.widget.ImageView; |
| | | import android.widget.LinearLayout; |
| | | import android.widget.TextView; |
| | | import android.widget.Toast; |
| | | |
| | | import com.bsk.zhangbo.demoforbsk.R; |
| | | import cn.com.basic.face.fragment.SurveillanceFragment; |
| | |
| | | mTabLayout.setTabMode(TabLayout.MODE_FIXED); |
| | | for (int i = 0; i < mTabLayout.getTabCount(); i++) { |
| | | TabLayout.Tab tab = mTabLayout.getTabAt(i); |
| | | tab.setCustomView(myFragmentPagerAdapter.getTabView(i)); |
| | | LinearLayout view = (LinearLayout)myFragmentPagerAdapter.getTabView(i); |
| | | tab.setCustomView(view); |
| | | if (i == 0) { |
| | | tab.getCustomView().setSelected(true); |
| | | } |
| | |
| | | |
| | | } |
| | | |
| | | boolean doubleBackToExitPressedOnce = false; |
| | | |
| | | @Override |
| | | public void onBackPressed() { |
| | | if (doubleBackToExitPressedOnce) { |
| | | super.onBackPressed(); |
| | | return; |
| | | } |
| | | |
| | | this.doubleBackToExitPressedOnce = true; |
| | | Toast.makeText(this, "请再次按返回键退出", Toast.LENGTH_SHORT).show(); |
| | | |
| | | new Handler().postDelayed(new Runnable() { |
| | | |
| | | @Override |
| | | public void run() { |
| | | doubleBackToExitPressedOnce=false; |
| | | } |
| | | }, 2000); |
| | | } |
| | | |
| | | } |