当前位置: 首页>>代码示例>>Java>>正文


Java TabWidget.setStripEnabled方法代码示例

本文整理汇总了Java中android.widget.TabWidget.setStripEnabled方法的典型用法代码示例。如果您正苦于以下问题:Java TabWidget.setStripEnabled方法的具体用法?Java TabWidget.setStripEnabled怎么用?Java TabWidget.setStripEnabled使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在android.widget.TabWidget的用法示例。


在下文中一共展示了TabWidget.setStripEnabled方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: init

import android.widget.TabWidget; //导入方法依赖的package包/类
private void init(Context context, AttributeSet attrs) {
	this.mContext = context;
	LayoutInflater.from(context).inflate(R.layout.tabhost_title_head, this, true);
	mTabWidget = (TabWidget) findViewById(android.R.id.tabs);
	setup();
	mTabWidget.setStripEnabled(false);
	initViewEvents();
	this.setBackgroundColor(Color.TRANSPARENT);
}
 
开发者ID:JasonFengIce,项目名称:AndroidTVWidget,代码行数:10,代码来源:OpenTabHost.java

示例2: onPageSelected

import android.widget.TabWidget; //导入方法依赖的package包/类
@Override
public void onPageSelected(int position) {
	// Unfortunately when TabHost changes the current tab, it kindly
	// also takes care of putting focus on it when not in touch mode.
	// The jerk.
	// This hack tries to prevent this from pulling focus out of our
	// ViewPager.
	TabWidget widget = mTabHost.getTabWidget();
	int oldFocusability = widget.getDescendantFocusability();
	widget.setDescendantFocusability(ViewGroup.FOCUS_BLOCK_DESCENDANTS);
	widget.setStripEnabled(true);
	linearlayouts[position].setPressed(true);
	mTabHost.setCurrentTab(position);
	widget.setDescendantFocusability(oldFocusability);
}
 
开发者ID:samuelhehe,项目名称:AppMarket,代码行数:16,代码来源:AtyHome2.java

示例3: onFinishInflate

import android.widget.TabWidget; //导入方法依赖的package包/类
@Override
protected void onFinishInflate() {
    mTabHost = (TabHost)findViewById(R.id.emoji_category_tabhost);
    mTabHost.setup();
    for (final EmojiCategory.CategoryProperties properties
            : mEmojiCategory.getShownCategories()) {
        addTab(mTabHost, properties.mCategoryId);
    }
    mTabHost.setOnTabChangedListener(this);
    final TabWidget tabWidget = mTabHost.getTabWidget();
    tabWidget.setStripEnabled(mCategoryIndicatorEnabled);
    if (mCategoryIndicatorEnabled) {
        // On TabWidget's strip, what looks like an indicator is actually a background.
        // And what looks like a background are actually left and right drawables.
        tabWidget.setBackgroundResource(mCategoryIndicatorDrawableResId);
        tabWidget.setLeftStripDrawable(mCategoryIndicatorBackgroundResId);
        tabWidget.setRightStripDrawable(mCategoryIndicatorBackgroundResId);
    }

    mEmojiPalettesAdapter = new EmojiPalettesAdapter(mEmojiCategory, this);

    mEmojiPager = (ViewPager)findViewById(R.id.emoji_keyboard_pager);
    mEmojiPager.setAdapter(mEmojiPalettesAdapter);
    mEmojiPager.setOnPageChangeListener(this);
    mEmojiPager.setOffscreenPageLimit(0);
    mEmojiPager.setPersistentDrawingCache(PERSISTENT_NO_CACHE);
    mEmojiLayoutParams.setPagerProperties(mEmojiPager);

    mEmojiCategoryPageIndicatorView =
            (EmojiCategoryPageIndicatorView)findViewById(R.id.emoji_category_page_id_view);
    mEmojiCategoryPageIndicatorView.setColors(
            mCategoryPageIndicatorColor, mCategoryPageIndicatorBackground);
    mEmojiLayoutParams.setCategoryPageIdViewProperties(mEmojiCategoryPageIndicatorView);

    setCurrentCategoryId(mEmojiCategory.getCurrentCategoryId(), true /* force */);

    final LinearLayout actionBar = (LinearLayout)findViewById(R.id.emoji_action_bar);
    mEmojiLayoutParams.setActionBarProperties(actionBar);

    // deleteKey depends only on OnTouchListener.
    mDeleteKey = (ImageButton)findViewById(R.id.emoji_keyboard_delete);
    mDeleteKey.setBackgroundResource(mFunctionalKeyBackgroundId);
    mDeleteKey.setTag(Constants.CODE_DELETE);
    mDeleteKey.setOnTouchListener(mDeleteKeyOnTouchListener);

    // {@link #mAlphabetKeyLeft}, {@link #mAlphabetKeyRight, and spaceKey depend on
    // {@link View.OnClickListener} as well as {@link View.OnTouchListener}.
    // {@link View.OnTouchListener} is used as the trigger of key-press, while
    // {@link View.OnClickListener} is used as the trigger of key-release which does not occur
    // if the event is canceled by moving off the finger from the view.
    // The text on alphabet keys are set at
    // {@link #startEmojiPalettes(String,int,float,Typeface)}.
    mAlphabetKeyLeft = (TextView)findViewById(R.id.emoji_keyboard_alphabet_left);
    mAlphabetKeyLeft.setBackgroundResource(mFunctionalKeyBackgroundId);
    mAlphabetKeyLeft.setTag(Constants.CODE_ALPHA_FROM_EMOJI);
    mAlphabetKeyLeft.setOnTouchListener(this);
    mAlphabetKeyLeft.setOnClickListener(this);
    mAlphabetKeyRight = (TextView)findViewById(R.id.emoji_keyboard_alphabet_right);
    mAlphabetKeyRight.setBackgroundResource(mFunctionalKeyBackgroundId);
    mAlphabetKeyRight.setTag(Constants.CODE_ALPHA_FROM_EMOJI);
    mAlphabetKeyRight.setOnTouchListener(this);
    mAlphabetKeyRight.setOnClickListener(this);
    mSpacebar = findViewById(R.id.emoji_keyboard_space);
    mSpacebar.setBackgroundResource(mSpacebarBackgroundId);
    mSpacebar.setTag(Constants.CODE_SPACE);
    mSpacebar.setOnTouchListener(this);
    mSpacebar.setOnClickListener(this);
    mEmojiLayoutParams.setKeyProperties(mSpacebar);
    mSpacebarIcon = findViewById(R.id.emoji_keyboard_space_icon);
}
 
开发者ID:sergeychilingaryan,项目名称:AOSP-Kayboard-7.1.2,代码行数:71,代码来源:EmojiPalettesView.java

示例4: onActivityCreated

import android.widget.TabWidget; //导入方法依赖的package包/类
@Override
public void onActivityCreated(Bundle savedInstanceState) {
    // TODO Auto-generated method stub
    super.onActivityCreated(savedInstanceState);
    iv_nav_indicator = (ImageView) mRootView.findViewById(R.id.tab_pager_nav_indicator);
    DisplayMetrics dm = new DisplayMetrics();
    getActivity().getWindowManager().getDefaultDisplay().getMetrics(dm);
    indicatorWidth = dm.widthPixels / 3;

    LayoutParams cursor_Params = iv_nav_indicator.getLayoutParams();
    //Toast.makeText(getActivity(), "indicatorWidth is:"+indicatorWidth, 1).show();
    cursor_Params.width = indicatorWidth;
    iv_nav_indicator.setLayoutParams(cursor_Params);
    addresses = getActivity().getResources().getStringArray(R.array.dt_nav_tab_menu);
    mTabWidget = (TabWidget) mRootView.findViewById(R.id.tabWidget1);
    mTabWidget.setStripEnabled(false);
    mTextTabs[0] = new TextView(mContext);
    mTextTabs[0].setFocusable(true);
    mTextTabs[0].setText(addresses[0]);
    mTextTabs[0].setTextSize(20);
    mTextTabs[0].setGravity(Gravity.CENTER);
    //mTextTabs[0].setTextColor(getResources().getColorStateList(R.drawable.dt_rb_blue_bg));
    mTabWidget.addView(mTextTabs[0]);
    /* 
     * Listener必须在mTabWidget.addView()之后再加入,用于覆盖默认的Listener,
     * mTabWidget.addView()中默认的Listener没有NullPointer检测。
     */
    mTextTabs[0].setOnClickListener(mTabClickListener);
    mTextTabs[1] = new TextView(mContext);
    mTextTabs[1].setFocusable(true);
    mTextTabs[1].setText(addresses[1]);
    mTextTabs[1].setTextSize(20);
    mTextTabs[1].setGravity(Gravity.CENTER);
    //mTextTabs[1].setTextColor(getResources().getColorStateList(R.drawable.dt_rb_blue_bg));
    mTabWidget.addView(mTextTabs[1]);
    mTextTabs[1].setOnClickListener(mTabClickListener);
    mTextTabs[2] = new TextView(mContext);
    mTextTabs[2].setFocusable(true);
    mTextTabs[2].setText(addresses[2]);
    mTextTabs[2].setTextSize(20);
    mTextTabs[2].setGravity(Gravity.CENTER);
    //mTextTabs[2].setTextColor(getResources().getColorStateList(R.drawable.dt_rb_blue_bg));
    mTabWidget.addView(mTextTabs[2]);
    mTextTabs[2].setOnClickListener(mTabClickListener);

    mViewPager = (ViewPager) mRootView.findViewById(R.id.viewPager1);
    mPagerAdapter = new MyPagerAdapter(getActivity().getSupportFragmentManager());
    mViewPager.setAdapter(mPagerAdapter);
    mViewPager.setOnPageChangeListener(mPageChangeListener);
    mViewPager.setOffscreenPageLimit(2);

    mTabWidget.setCurrentTab(0);
    //mTabWidget.setOnFocusChangeListener(mTabChangeListener);
}
 
开发者ID:peterfuture,项目名称:dttv-android,代码行数:55,代码来源:SlideTabsFragment.java

示例5: MaterialTabHost

import android.widget.TabWidget; //导入方法依赖的package包/类
public MaterialTabHost(Context context, AttributeSet attrs) {
    super(context, attrs);

    inflater = LayoutInflater.from(context);

    TypedValue outValue = new TypedValue();
    Resources.Theme theme = context.getTheme();

    // use ?attr/colorPrimary as background color
    theme.resolveAttribute(R.attr.colorPrimary, outValue, true);
    setBackgroundColor(outValue.data);

    // use ?attr/colorControlActivated as default indicator color
    theme.resolveAttribute(R.attr.colorControlActivated, outValue, true);
    colorControlActivated = outValue.data;

    TypedArray a = context.getTheme().obtainStyledAttributes(attrs, R.styleable.MaterialTabHost, 0, 0);
    int indicatorColor = a.getColor(R.styleable.MaterialTabHost_colorTabIndicator, colorControlActivated);
    a.recycle();

    // ColorDrawable on 2.x does not use getBounds() so use ShapeDrawable
    indicator = new ShapeDrawable();
    indicator.setColorFilter(indicatorColor, PorterDuff.Mode.SRC_ATOP);

    Resources res = context.getResources();
    indicatorHeight = res.getDimensionPixelSize(R.dimen.mth_tab_indicator_height);
    leftOffset = res.getDimensionPixelSize(R.dimen.mth_tab_left_offset);
    int tabHeight = res.getDimensionPixelSize(R.dimen.mth_tab_height);

    tabWidget = new TabWidget(context);
    tabWidget.setLayoutParams(new LayoutParams(LayoutParams.MATCH_PARENT, tabHeight));
    tabWidget.setId(android.R.id.tabs);
    tabWidget.setStripEnabled(false);
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) {
        tabWidget.setShowDividers(LinearLayout.SHOW_DIVIDER_NONE);
    }
    addView(tabWidget);

    FrameLayout fl = new FrameLayout(context);
    fl.setLayoutParams(new LayoutParams(0, 0));
    fl.setId(android.R.id.tabcontent);
    addView(fl);

    setup();

    setOnTabChangedListener(new TabHost.OnTabChangeListener() {
        @Override
        public void onTabChanged(String tabId) {
            if (listener != null) {
                listener.onTabSelected(Integer.valueOf(tabId));
            }
        }
    });

    float density = getResources().getDisplayMetrics().density;

    // set elevation for App bar
    // http://www.google.com/design/spec/what-is-material/objects-in-3d-space.html#objects-in-3d-space-elevation
    ViewCompat.setElevation(this, APP_TAB_ELEVATION * density);
}
 
开发者ID:yanzm,项目名称:MaterialTabHost,代码行数:61,代码来源:MaterialTabHost.java

示例6: onCreate

import android.widget.TabWidget; //导入方法依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    setContentView(R.layout.demo_tab_view);

    mTabWidget = ( TabWidget) findViewById(R.id.tabWidget1);

    mTabWidget.setStripEnabled(false);
    mTabWidget.setFocusable(false);

    for (int i = 0; i < mTabWidget.getChildCount(); i++) {
        mTabWidget.getChildAt(i).setOnClickListener(mTabClickListener);
        mTabWidget.getChildAt(i).setOnFocusChangeListener(mTabFocusListener);
    }

    mViewPager = (ViewPager) findViewById(R.id.viewPager1);
    mPagerAdapter = new MyPagerAdapter();
    mViewPager.setAdapter(mPagerAdapter);
    mViewPager.setOnPageChangeListener(mPageChangeListener);

    mPagerAdapter.notifyDataSetChanged();


    mTabWidget.focusCurrentTab(0);

    BorderView borderView = new BorderView(this);

    borderView.setBackgroundResource(R.drawable.border_highlight);
    borderView.attachTo(mTabWidget);

    BorderView borderView2 = new BorderView(this);

     borderView2.setBackgroundResource(R.drawable.border_white_light_10);
    borderView2.attachTo(mViewPager);

}
 
开发者ID:evilbinary,项目名称:TvWidget,代码行数:38,代码来源:DemoTabActivity.java


注:本文中的android.widget.TabWidget.setStripEnabled方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。