コード例 #1
0
  @Override
  public View onCreateView(
      LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {

    View view = inflater.inflate(R.layout.fragment_display_novel_tab, container, false);

    mTabHost = (FragmentTabHost) view.findViewById(android.R.id.tabhost);
    mTabHost.setup(getSherlockActivity(), getChildFragmentManager(), R.id.content);

    Bundle mainBundle = new Bundle();
    mainBundle.putString(Constants.EXTRA_NOVEL_LIST_MODE, Constants.EXTRA_NOVEL_LIST_MODE_MAIN);
    mainBundle.putBoolean(Constants.EXTRA_ONLY_WATCHED, false);
    mTabHost.addTab(
        mTabHost.newTabSpec(MAIN_SPEC).setIndicator(MAIN_SPEC),
        DisplayLightNovelListFragment.class,
        mainBundle);

    Bundle teaserBundle = new Bundle();
    teaserBundle.putString(Constants.EXTRA_NOVEL_LIST_MODE, Constants.EXTRA_NOVEL_LIST_MODE_TEASER);
    mTabHost.addTab(
        mTabHost.newTabSpec(TEASER_SPEC).setIndicator(TEASER_SPEC),
        DisplayLightNovelListFragment.class,
        teaserBundle);

    Bundle oriBundle = new Bundle();
    oriBundle.putString(Constants.EXTRA_NOVEL_LIST_MODE, Constants.EXTRA_NOVEL_LIST_MODE_ORIGINAL);
    mTabHost.addTab(
        mTabHost.newTabSpec(ORIGINAL_SPEC).setIndicator(ORIGINAL_SPEC),
        DisplayLightNovelListFragment.class,
        oriBundle);

    return view;
  }
コード例 #2
0
  @Override
  public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.main);

    mTabHost = (FragmentTabHost) findViewById(android.R.id.tabhost);

    mTabHost.setup(this, getSupportFragmentManager(), R.id.tabcontent);

    mTabHost.addTab(
        mTabHost
            .newTabSpec(getString(R.string.tab_accept))
            .setIndicator(getString(R.string.tab_accept)),
        AcceptPaymentFragment.class,
        null);
    mTabHost.addTab(
        mTabHost
            .newTabSpec(getString(R.string.tab_reverse))
            .setIndicator(getString(R.string.tab_reverse)),
        ReverseFragment.class,
        null);
    mTabHost.addTab(
        mTabHost
            .newTabSpec(getString(R.string.tab_printer))
            .setIndicator(getString(R.string.tab_printer)),
        PrinterFragment.class,
        null);
  }
コード例 #3
0
  public void initTab(String result) {
    tabHost.setup(this, getSupportFragmentManager(), R.id.realtabcontent);
    try {
      JSONObject jsonObj = new JSONObject(result);
      JSONArray jsonArraySuccess = jsonObj.getJSONArray("Success");
      JSONArray jsonArrayFail = jsonObj.getJSONArray("Fail");
      int totalBooksBorrow = jsonArraySuccess.length() + jsonArrayFail.length();

      Bundle success = new Bundle();
      success.putString("Json", jsonArraySuccess.toString());
      success.putInt("totalBooksBorrow", totalBooksBorrow);

      Bundle fail = new Bundle();
      fail.putString("Json", jsonArrayFail.toString());
      fail.putInt("totalBooksBorrow", totalBooksBorrow);

      tabHost.addTab(
          tabHost.newTabSpec("Success").setIndicator("Success"),
          SuccessBorrowBookFragment.class,
          success);
      tabHost.addTab(
          tabHost.newTabSpec("Fail").setIndicator("Fail"), FailBorrowBookFragment.class, fail);

      tabHost.setOnTabChangedListener(
          new TabHost.OnTabChangeListener() {
            @Override
            public void onTabChanged(String tabId) {
              /*Toast.makeText(ShowBorrowBooksResultActivity.this, "Tab Changed", Toast.LENGTH_SHORT).show();*/
            }
          });
    } catch (JSONException e) {
      e.printStackTrace();
    }
  }
コード例 #4
0
  @Override
  protected void onCreate(Bundle bundle) {
    super.onCreate(bundle);
    setContentView(R.layout.activity4fragment_my);
    initViews();

    FragmentTabHost tabHost = (FragmentTabHost) findViewById(android.R.id.tabhost);
    tabHost.setup(this, getSupportFragmentManager(), R.id.frame_content);

    tabHost.addTab(
        tabHost
            .newTabSpec(String.valueOf(TABS[0]))
            .setIndicator(getLayoutInflater().inflate(TABS[0], null)),
        TimesFragment.class,
        null);
    tabHost.addTab(
        tabHost
            .newTabSpec(String.valueOf(TABS[1]))
            .setIndicator(getLayoutInflater().inflate(TABS[1], null)),
        KChartsFragment.class,
        null);
    tabHost.addTab(
        tabHost
            .newTabSpec(String.valueOf(TABS[2]))
            .setIndicator(getLayoutInflater().inflate(TABS[2], null)),
        GuideFragment.class,
        null);
    tabHost.addTab(
        tabHost
            .newTabSpec(String.valueOf(TABS[3]))
            .setIndicator(getLayoutInflater().inflate(TABS[3], null)),
        AboutFragment.class,
        null);
  }
コード例 #5
0
ファイル: MyPageFragment.java プロジェクト: yeahXD/NearByMe
  @Override
  public View onCreateView(
      LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    // Inflate the layout for this fragment
    View view = inflater.inflate(R.layout.fragment_my_page, container, false);
    btn = (Button) view.findViewById(R.id.btn_setting);
    userImage = (CircularImageView) view.findViewById(R.id.image_user);
    userName = (TextView) view.findViewById(R.id.text_name);

    btn.setOnClickListener(
        new View.OnClickListener() {
          @Override
          public void onClick(View v) {
            if (PropertyManager.getInstance().getIsGuest() == 0) {
              Intent intent = new Intent(getContext(), SettingActivity.class);
              startActivity(intent);
            } else {
              Toast.makeText(getContext(), "로그인이 필요한 서비스입니다", Toast.LENGTH_SHORT).show();
            }
          }
        });

    if (PropertyManager.getInstance().getIsGuest() == 0) {
      Glide.with(userImage.getContext())
          .load(PropertyManager.getInstance().getUser_profilePic())
          .into(userImage);
      userName.setText(PropertyManager.getInstance().getUser_name());
    } else {
      userName.setText("손님");
    }

    ImageView tabView_myreview = new ImageView(getContext());
    tabView_myreview.setImageResource(R.drawable.tab_myreview_selector);

    ImageView tabView_likestore = new ImageView(getContext());
    tabView_likestore.setImageResource(R.drawable.tab_likestore_selector);

    ImageView tabView_likereview = new ImageView(getContext());
    tabView_likereview.setImageResource(R.drawable.tab_likereview_selector);

    mTabHost = (FragmentTabHost) view.findViewById(android.R.id.tabhost);
    mTabHost.setup(getContext(), getChildFragmentManager(), R.id.realtabcontent);
    mTabHost.addTab(
        mTabHost.newTabSpec("myReview").setIndicator(tabView_myreview),
        ViewMyReviewFragment.class,
        null);
    mTabHost.addTab(
        mTabHost.newTabSpec("likeStore").setIndicator(tabView_likestore),
        ViewLikeStoreFragment.class,
        null);
    mTabHost.addTab(
        mTabHost.newTabSpec("likeReview").setIndicator(tabView_likereview),
        ViewLikeReviewFragment.class,
        null);

    return view;
  }
コード例 #6
0
  @Override
  public View onCreateView(
      LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {

    View rootView = inflater.inflate(R.layout.fragment_movie_detail_tabs, container, false);

    // Receive the movie object
    Intent intent = getActivity().getIntent();
    mMovie = intent.getParcelableExtra(PopularMovies.MOVIE);

    if (mMovie == null) {
      Bundle bundle = this.getArguments();
      mMovie = bundle.getParcelable(PopularMovies.MOVIE);
    }

    Context context = getActivity().getBaseContext();
    // TabHost
    tabHost = (FragmentTabHost) rootView.findViewById(android.R.id.tabhost);
    tabHost.setup(context, getChildFragmentManager(), android.R.id.tabcontent);

    // add tabs Fragments
    Bundle bundle = new Bundle();
    bundle.putParcelable(PopularMovies.MOVIE, mMovie);

    // Bring Trailers

    // Bring reviews

    tabHost.addTab(
        tabHost
            .newTabSpec("movie_details")
            .setIndicator(getTabIndicator(context, getString(R.string.tab_movie_details))),
        MovieDetailActivityFragment.class,
        bundle);
    tabHost.addTab(
        tabHost
            .newTabSpec("movie_trailers")
            .setIndicator(getTabIndicator(context, getString(R.string.tab_movie_trailers))),
        MovieTrailerFragment.class,
        bundle);
    tabHost.addTab(
        tabHost
            .newTabSpec("movie_reviews")
            .setIndicator(getTabIndicator(context, getString(R.string.tab_movie_reviews))),
        MovieReviewFragment.class,
        bundle);

    return rootView;
  }
コード例 #7
0
ファイル: FragmentTab.java プロジェクト: BKId95/FreakingMath
  @Nullable
  @Override
  public View onCreateView(
      LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    View view = inflater.inflate(R.layout.fragment_tabhost, null);
    mTabHost = (FragmentTabHost) view.findViewById(android.R.id.tabhost);
    mTabHost.setup(getActivity(), getChildFragmentManager(), android.R.id.tabcontent);

    mTabHost.addTab(
        mTabHost.newTabSpec("tab1").setIndicator("Tab 1", null), FragmentTab1.class, null);
    mTabHost.addTab(
        mTabHost.newTabSpec("tab2").setIndicator("Tab 2", null), FragmentTab1.class, null);

    return view;
  }
コード例 #8
0
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_root);

    tabHost = (FragmentTabHost) findViewById(android.R.id.tabhost);
    tabHost.setup(this, getSupportFragmentManager(), R.id.realtabcontent);
    tabHost.addTab(
        tabHost
            .newTabSpec("manager")
            .setIndicator(createTabItem("课程管理", R.drawable.ic_tab_manager)),
        CourseManagerFragment.class,
        null);

    View groupTabItem = createTabItem("学生群组", R.drawable.ic_tab_group);
    groupDot = groupTabItem.findViewById(R.id.dot);
    tabHost.addTab(
        tabHost.newTabSpec("chatlist").setIndicator(groupTabItem), ChatListFragment.class, null);
    tabHost.addTab(
        tabHost
            .newTabSpec("material")
            .setIndicator(createTabItem("教材教具", R.drawable.ic_tab_material)),
        TeachMaterialFragment.class,
        null);

    View mineTabItem = createTabItem("我的", R.drawable.ic_tab_mine);
    mineDot = mineTabItem.findViewById(R.id.dot);
    tabHost.addTab(tabHost.newTabSpec("mine").setIndicator(mineTabItem), MineFragment.class, null);

    tabHost.setOnTabChangedListener(this);

    // Umeng
    MobclickAgent.updateOnlineConfig(this);
    UmengUpdateAgent.silentUpdate(this);

    // RongCloud
    doRCIMConnect(3);

    isFirstLogin = Boolean.valueOf(getIntent().getData().getQueryParameter("isFirstLogin"));
    if (isFirstLogin) {
      startActivity("sgteacher://applyteacher?fromLogin=true");
    }

    RongIM.setOnReceiveMessageListener(this);

    setSwipeBackEnable(false);
  }
コード例 #9
0
  @Override
  public View onCreateView(
      LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    // Inflate the layout for this fragment
    View rootView = inflater.inflate(R.layout.market, container, false);
    mTabHost = (FragmentTabHost) rootView.findViewById(android.R.id.tabhost);
    mTabHost.setup(getActivity(), getChildFragmentManager(), android.R.id.tabcontent);

    mTabHost.addTab(
        mTabHost.newTabSpec("NYSE").setIndicator("NYSE", null), TabFragment2.class, null);
    mTabHost.addTab(
        mTabHost.newTabSpec("NASDAQ").setIndicator("NASDAQ", null), TabFragment2.class, null);
    mTabHost.addTab(
        mTabHost.newTabSpec("AMEX").setIndicator("AMEX", null), TabFragment2.class, null);

    return rootView;
  }
コード例 #10
0
  @Override
  public View onCreateView(
      LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    mTabHost = new FragmentTabHost(getActivity());
    mTabHost.setup(getActivity(), getChildFragmentManager(), R.id.note_list_pipe);

    mTabHost.addTab(
        mTabHost.newTabSpec("Pitch Pipe").setIndicator("Pitch Pipe"),
        NoteListFragmentPipe.class,
        null); // pipe tab
    mTabHost.addTab(
        mTabHost.newTabSpec("Piano").setIndicator("Piano"),
        NoteListFragmentPiano.class,
        null); // piano tab

    return mTabHost;
  }
コード例 #11
0
  @Override
  public View onCreateView(
      LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    Bundle bundle = new Bundle();
    bundle.putString("id", id);
    bundle.putString("password", password);
    bundle.putString("cloudName", name);
    bundle.putString("ip", ip);

    mTabHost = new FragmentTabHost(getActivity());
    mTabHost.setup(getActivity(), getChildFragmentManager(), R.id.tabHost_plan);
    mTabHost.addTab(
        mTabHost.newTabSpec("currentPlan").setIndicator("Current Plan"), View_plan.class, bundle);
    mTabHost.addTab(
        mTabHost.newTabSpec("changePlan").setIndicator("Change Plan"),
        ChangePlane_page.class,
        bundle);
    return mTabHost;
  }
コード例 #12
0
ファイル: FirstFragment.java プロジェクト: dotfeng/Android
 @Override
 public View onCreateView(
     LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
   // TODO Auto-generated method stub
   View v = inflater.inflate(R.layout.fragment_layout_one, container, false);
   tabHost = (FragmentTabHost) v.findViewById(android.R.id.tabhost);
   tabHost.setup(getActivity(), getChildFragmentManager(), R.id.realtabcontent2);
   tabHost.addTab(tabHost.newTabSpec("one").setIndicator("one"), ChildOneFragment.class, null);
   tabHost.addTab(tabHost.newTabSpec("two").setIndicator("two"), ChildTwoFragment.class, null);
   return v;
 }
コード例 #13
0
  // 重写该方法,该方法返回的View将作为Fragment显示的组件
  @Override
  public View onCreateView(
      LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    // 加载/res/layout/目录下的fragment_bridge_detail.xml布局文件
    View rootView = inflater.inflate(R.layout.fragment_disease_edit, null);

    mTabHost = (FragmentTabHost) rootView.findViewById(android.R.id.tabhost);
    mTabHost.setup(getActivity(), getChildFragmentManager(), R.id.realtabcontent);

    // 设置标签页属性及bundle参数
    mTabHost.addTab(
        mTabHost.newTabSpec("sub1").setIndicator("上部结构"), SubFragment1.class, getArguments());

    mTabHost.addTab(
        mTabHost.newTabSpec("sub2").setIndicator("下部结构"), SubFragment2.class, getArguments());

    mTabHost.addTab(
        mTabHost.newTabSpec("sub3").setIndicator("桥面系"), SubFragment3.class, getArguments());

    return rootView;
  }
コード例 #14
0
ファイル: Stats.java プロジェクト: suju26/mr
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_stats);
    // Show the Up button in the action bar.
    setupActionBar();
    mTabHost = (FragmentTabHost) findViewById(android.R.id.tabhost);
    mTabHost.setup(this, getSupportFragmentManager(), R.id.realtabcontent);

    spec =
        mTabHost
            .newTabSpec("1")
            .setIndicator(null, getResources().getDrawable(R.drawable.user_icon_blue));
    mTabHost.addTab(spec, StatsTabBody.class, null);
    spec =
        mTabHost
            .newTabSpec("2")
            .setIndicator(null, getResources().getDrawable(R.drawable.arm_logo));
    mTabHost.addTab(spec, StatsTabExercises.class, null);
    mTabHost.setCurrentTab(statsTabCurrentPosition);
    mTabHost.setOnTabChangedListener(this);
  }
コード例 #15
0
  @TargetApi(Build.VERSION_CODES.LOLLIPOP)
  public void initTabs() {

    tabHost = (FragmentTabHost) findViewById(android.R.id.tabhost);
    tabHost.setup(this, getSupportFragmentManager(), R.id.tabcontent);

    View LoginView = LayoutInflater.from(this).inflate(R.layout.tab_login, null);
    tabHost.addTab(
        tabHost.newTabSpec(TAB_LOGIN).setIndicator(LoginView), LoginFragment.class, null);

    View SignInView = LayoutInflater.from(this).inflate(R.layout.tab_signin, null);
    tabHost.addTab(
        tabHost.newTabSpec(TAB_SIGNIN).setIndicator(SignInView), SignInFragment.class, null);

    tabHost.setOnTabChangedListener(
        new TabHost.OnTabChangeListener() {
          @Override
          public void onTabChanged(String tabId) {

            int currentTab = tabHost.getCurrentTab();

            switch (currentTab) {
              case 0:
                setActive(R.id.tabLogin0);
                setActiveEsp(R.id.tabLogin1);
                setInactive(R.id.tabSignIn0);
                setInactiveEsp(R.id.tabSignIn1);
                break;
              case 1:
                setActive(R.id.tabSignIn0);
                setActiveEsp(R.id.tabSignIn1);
                setInactive(R.id.tabLogin0);
                setInactiveEsp(R.id.tabLogin1);
                break;
            }
          }
        });
  }
コード例 #16
0
ファイル: MainActivity.java プロジェクト: 1c71/Learn-Android
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);

    //  1 初始化
    tabhost = (FragmentTabHost) findViewById(android.R.id.tabhost);
    tabhost.setup(this, getSupportFragmentManager(), R.id.activity_home_container);

    // 2 新建 TabSpec
    TabHost.TabSpec spec = tabhost.newTabSpec(TAG_CHAT);
    spec.setIndicator("消息");

    // 3 添加 TabSpec
    tabhost.addTab(spec, MyFragment.class, null);
  }
コード例 #17
0
  private void setupTab(Class<?> fragClass, final View view, final String tag, Bundle bundle) {
    View tabview = createTabView(mTabHost.getContext(), tag);

    TabSpec setContent =
        mTabHost
            .newTabSpec(tag)
            .setIndicator(tabview)
            .setContent(
                new TabContentFactory() {
                  @Override
                  public View createTabContent(String tag) {
                    return view;
                  }
                });
    mTabHost.addTab(setContent, fragClass, bundle);
  }
コード例 #18
0
  @SuppressWarnings("rawtypes")
  private void AddTab(String tag, int title, int i, Class cls) {
    TabSpec tabSpec = mTabHost.newTabSpec(tag);
    View view = getLayoutInflater().inflate(R.layout.ic_tab_item, null);
    ImageView image = (ImageView) view.findViewById(R.id.tab_image);
    TextView textview = (TextView) view.findViewById(R.id.tab_text);
    textview.setText(title);
    image.setBackgroundResource(imagelist[i]);
    mTabHost.addTab(tabSpec.setIndicator(view), cls, null);
    mTabHost.setOnTabChangedListener(
        new OnTabChangeListener() {

          @Override
          public void onTabChanged(String tabId) {
            if (tabId.equals("3")) {
              if (TextUtils.isEmpty(GlobalVariable.UserID)) {
                showShortToast("请客官先登录");
                startActivityForResult(LoginActivity.class, null, 343);
              }
            }
          }
        });
  }
コード例 #19
0
  private void initView() {

    // scrollView_course_detail = (ScrollView) mView.findViewById(R.id.scrollView_course_detail);
    // 设置 scrollView 定位到顶部
    ll_course_detail = (LinearLayout) findViewById(R.id.ll_course_detail);
    ll_course_detail.setFocusable(true);
    ll_course_detail.setFocusableInTouchMode(true);
    ll_course_detail.requestFocus();
    mLayoutInflater = LayoutInflater.from(this);
    // 找到TabHost
    mTabHost = (FragmentTabHost) findViewById(android.R.id.tabhost);
    mTabHost.setup(this, getSupportFragmentManager(), R.id.realtabcontent);
    mAbSlidingPlayView = (AbSlidingPlayView) findViewById(R.id.mAbSlidingPlayView);
    mAbSlidingPlayView.setNavHorizontalGravity(Gravity.CENTER);
    // mAbSlidingPlayView.setParentHScrollView(menuLayout);
    mAbSlidingPlayView.startPlay();
    // 得到fragment的个数
    int count = mFragmentArray.length;
    for (int i = 0; i < count; i++) {
      // 给每个Tab按钮设置图标、文字和内容
      TabSpec tabSpec = mTabHost.newTabSpec(mTextArray[i]).setIndicator(getTabItemView(i));
      Bundle bundle = new Bundle();
      bundle.putString(Constants.KEY_ID, id);
      // 将Tab按钮添加进Tab选项卡中
      mTabHost.addTab(tabSpec, mFragmentArray[i], bundle);
      // 设置Tab按钮的背景
      mTabHost.getTabWidget().getChildAt(i).setBackgroundResource(R.drawable.selector_detail_tab);
    }
    titlebar = (TitleBar) findViewById(R.id.index_titlebar);
    titlebar.setTitleBarTitle(title);

    ivShare = (ImageView) findViewById(R.id.title_share);
    btZixun = (Button) findViewById(R.id.bt_book);
    btBuy = (Button) findViewById(R.id.bt_buy);
    dialog = new CustomProgressDialog(this, R.string.laoding_tips, R.anim.frame2);
    dialog.show();
  }
コード例 #20
0
  @Override
  public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    ImageLoaderConfiguration configuration =
        new ImageLoaderConfiguration.Builder(this).threadPoolSize(3).build();
    ImageLoader.getInstance().init(configuration);

    setContentView(R.layout.profile);
    ActionBarInitializer.getInstance().initFor(this);
    final FragmentTabHost fragmentTabHost = (FragmentTabHost) findViewById(R.id.fragment_tab_host);
    fragmentTabHost.setup(this, getSupportFragmentManager(), R.id.realtabcontent);
    fragmentTabHost.addTab(
        fragmentTabHost.newTabSpec("board").setIndicator(getString(R.string.tab_home)),
        BoardFragment.class,
        new Bundle());
    fragmentTabHost.addTab(
        fragmentTabHost.newTabSpec("friends").setIndicator(getString(R.string.tab_friends)),
        FriendsFragment.class,
        new Bundle());
    fragmentTabHost.addTab(
        fragmentTabHost.newTabSpec("messages").setIndicator(getString(R.string.tab_messages)),
        MessagesFragment.class,
        new Bundle());
    fragmentTabHost.addTab(
        fragmentTabHost.newTabSpec("event").setIndicator(getString(R.string.tab_event)),
        EventFragment.class,
        new Bundle());
    fragmentTabHost.addTab(
        fragmentTabHost.newTabSpec("map").setIndicator("Map"), MapFragment.class, new Bundle());
    fragmentTabHost.addTab(
        fragmentTabHost.newTabSpec("comments").setIndicator("Comments"),
        CommentsFragment.class,
        new Bundle());
    fragmentTabHost.addTab(
        fragmentTabHost.newTabSpec("content").setIndicator("Content"),
        ContentFragment.class,
        new Bundle());
    //        fragmentTabHost.addTab(fragmentTabHost.newTabSpec("add").setIndicator("Add"))
  }