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


Java View.setSelected方法代码示例

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


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

示例1: onPageSelected

import android.view.View; //导入方法依赖的package包/类
public void onPageSelected(int position) {
    if (this.mScrollState == 0) {
        SlidingTabLayout.this.mTabStrip.onViewPagerPageChanged(position, 0.0f);
        SlidingTabLayout.this.scrollToTab(position, 0);
    }
    for (int i = 0; i < SlidingTabLayout.this.mTabStrip.getChildCount(); i++) {
        boolean z;
        View childAt = SlidingTabLayout.this.mTabStrip.getChildAt(i);
        if (position == i) {
            z = true;
        } else {
            z = false;
        }
        childAt.setSelected(z);
    }
    if (SlidingTabLayout.this.mViewPagerPageChangeListener != null) {
        SlidingTabLayout.this.mViewPagerPageChangeListener.onPageSelected(position);
    }
}
 
开发者ID:JackChan1999,项目名称:boohee_v5.6,代码行数:20,代码来源:SlidingTabLayout.java

示例2: setCurrentItem

import android.view.View; //导入方法依赖的package包/类
public void setCurrentItem(int item) {
    if (this.mViewPager == null) {
        throw new IllegalStateException("ViewPager has not been bound.");
    }
    this.mSelectedIndex = item;
    this.mViewPager.setCurrentItem(item);
    int tabCount = this.mIconsLayout.getChildCount();
    int i = 0;
    while (i < tabCount) {
        View child = this.mIconsLayout.getChildAt(i);
        boolean isSelected = i == item;
        child.setSelected(isSelected);
        if (isSelected) {
            animateToIcon(item);
        }
        i++;
    }
}
 
开发者ID:JackChan1999,项目名称:boohee_v5.6,代码行数:19,代码来源:IconPageIndicator.java

示例3: setCurrentItem

import android.view.View; //导入方法依赖的package包/类
@Override
public void setCurrentItem(int item) {
    if (mViewPager == null) {
        throw new IllegalStateException("ViewPager has not been bound.");
    }
    mSelectedTabIndex = item;
    mViewPager.setCurrentItem(item);

    final int tabCount = mTabLayout.getChildCount();
    for (int i = 0; i < tabCount; i++) {
        final View child = mTabLayout.getChildAt(i);
        final boolean isSelected = (i == item);
        child.setSelected(isSelected);
        if (isSelected) {
            animateToTab(item);
        }
    }
}
 
开发者ID:SavorGit,项目名称:Hotspot-master-devp,代码行数:19,代码来源:TabPageIndicator.java

示例4: setCurrentItem

import android.view.View; //导入方法依赖的package包/类
public void setCurrentItem(int item) {
    if (this.mViewPager != null) {
        if (!(item == -1 || this.mSelectedTabIndex == item)) {
            this.mViewPager.setCurrentItem(item);
        }
        this.mSelectedTabIndex = item;
        int tabCount = this.mTabLayout.getChildCount();
        int i = 0;
        while (i < tabCount) {
            View child = this.mTabLayout.getChildAt(i);
            boolean isSelected = i == item;
            child.setSelected(isSelected);
            if (isSelected) {
                animateToTab(item);
                ((TabView) child).setTextColor(this.mContext.getResources().getColor(2131493202));
                child.setBackgroundResource(2130839011);
            } else {
                ((TabView) child).setTextColor(this.mContext.getResources().getColor(2131493237));
                child.setBackgroundDrawable(null);
            }
            i++;
        }
    }
}
 
开发者ID:JackChan1999,项目名称:letv,代码行数:25,代码来源:HotTabPageIndicator.java

示例5: init

import android.view.View; //导入方法依赖的package包/类
private void init() {
    mDrawingBoardView = (DrawingBoardView) mCoverView.findViewById(R.id.drawingBoard);
    View btn = mCoverView.findViewById(R.id.on_off);
    btn.setSelected(false);
    btn.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            v.setSelected(!v.isSelected());
            if (v.isSelected()) {
                mMetronome.post(mRhythm);
            } else {
                mMetronome.removeCallbacks(mRhythm);
                mPerformance.eraseColor(0);
                mDrawingBoardView.drawPerformance(mPerformance);
            }
        }
    });
}
 
开发者ID:android-notes,项目名称:renderingPerformance,代码行数:19,代码来源:Manager.java

示例6: setSelected

import android.view.View; //导入方法依赖的package包/类
public void setSelected(Page selected) {
    final int childCount = iconsHolder.getChildCount();
    for (int i = 0; i < childCount; i++) {
        final View child = iconsHolder.getChildAt(i);
        final boolean isSelected = ObjectUtil.equals(child.getTag(), selected.getId());
        child.setSelected(isSelected);
        if (isSelected) {
            setupArrowPosition(child);
        }
    }
    setupPage(selected);
    title.setText(selected.getTitle());
}
 
开发者ID:roshakorost,项目名称:Phial,代码行数:14,代码来源:ExpandedView.java

示例7: onFabClick

import android.view.View; //导入方法依赖的package包/类
private void onFabClick(View v) {
  if (v.isSelected()) {
    hideMenu();
  } else {
    showMenu();
  }
  v.setSelected(!v.isSelected());
}
 
开发者ID:xzg8023,项目名称:ArcLayout-master,代码行数:9,代码来源:DemoLikePathActivity.java

示例8: setCurrentItem

import android.view.View; //导入方法依赖的package包/类
public void setCurrentItem(int item) {
    if (this.mViewPager != null) {
        if (item != -1 || this.mSelectedTabIndex != item) {
            this.mSelectedTabIndex = item;
            int tabCount = this.mTabLayout.getChildCount();
            for (int i = 0; i < tabCount; i++) {
                RelativeLayout childLayout = (RelativeLayout) this.mTabLayout.getChildAt(i);
                for (int j = 0; j < childLayout.getChildCount(); j++) {
                    boolean isSelected;
                    if (i == item) {
                        isSelected = true;
                    } else {
                        isSelected = false;
                    }
                    View view = childLayout.getChildAt(j);
                    if (view instanceof TabView) {
                        view.setSelected(isSelected);
                        if (isSelected) {
                            animateToTab(item);
                        }
                    } else {
                        view.setSelected(isSelected);
                    }
                }
            }
            this.mViewPager.setCurrentItem(item, false);
        }
    }
}
 
开发者ID:JackChan1999,项目名称:letv,代码行数:30,代码来源:ChannelTabPageIndicator.java

示例9: setCurrentItem

import android.view.View; //导入方法依赖的package包/类
@Override
public void setCurrentItem(int item) {
	if (mViewPager == null) {
		throw new IllegalStateException("ViewPager has not been bound.");
	}
	mSelectedTabIndex = item;
	mViewPager.setCurrentItem(item);

	final int tabCount = mTabLayout.getChildCount();
	for (int i = 0; i < tabCount; i++) {
		final View child = mTabLayout.getChildAt(i);

		final boolean isSelected = (i == item);
		child.setSelected(isSelected);

		if (isSelected) {
			if (child instanceof TabView) {
				((TabView) child).text.setTextColor(selectedTextColor);
				((TabView) child).view.setVisibility(View.VISIBLE);
			}
			animateToTab(item);
		} else {
			if (child instanceof TabView) {
				((TabView) child).text.setTextColor(unSelectedTextColor);
				((TabView) child).view.setVisibility(View.GONE);
			}

		}
	}
}
 
开发者ID:iPanelkegy,项目名称:MobileMedia,代码行数:31,代码来源:UnderLinePageIndicator.java

示例10: initAudioCallView

import android.view.View; //导入方法依赖的package包/类
private void initAudioCallView() {
    mLPreviewContainer.removeAllViews();
    mLPreviewContainer.setVisibility(View.GONE);
    mSPreviewContainer.removeAllViews();
    mSPreviewContainer.setVisibility(View.GONE);

    findViewById(R.id.rc_voip_call_information).setBackgroundColor(getResources().getColor(R.color.rc_voip_background_color));
    findViewById(R.id.rc_voip_audio_chat).setVisibility(View.GONE);

    View userInfoView = inflater.inflate(R.layout.rc_voip_audio_call_user_info, null);
    TextView timeView = (TextView) userInfoView.findViewById(R.id.rc_voip_call_remind_info);
    setupTime(timeView);

    mUserInfoContainer.removeAllViews();
    mUserInfoContainer.addView(userInfoView);
    UserInfo userInfo = RongContext.getInstance().getUserInfoFromCache(targetId);
    if (userInfo != null) {
        TextView userName = (TextView) mUserInfoContainer.findViewById(R.id.rc_voip_user_name);
        userName.setText(userInfo.getName());
        if (callSession.getMediaType().equals(RongCallCommon.CallMediaType.AUDIO)) {
            AsyncImageView userPortrait = (AsyncImageView) mUserInfoContainer.findViewById(R.id.rc_voip_user_portrait);
            if (userPortrait != null) {
                userPortrait.setAvatar(userInfo.getPortraitUri().toString(), R.drawable.rc_default_portrait);
            }
        }
    }
    mUserInfoContainer.setVisibility(View.VISIBLE);
    mUserInfoContainer.findViewById(R.id.rc_voip_call_minimize).setVisibility(View.VISIBLE);

    View button = inflater.inflate(R.layout.rc_voip_call_bottom_connected_button_layout, null);
    mButtonContainer.removeAllViews();
    mButtonContainer.addView(button);
    mButtonContainer.setVisibility(View.VISIBLE);
    View handFreeV = mButtonContainer.findViewById(R.id.rc_voip_handfree);
    handFreeV.setSelected(handFree);

    if (pickupDetector != null) {
        pickupDetector.register(this);
    }
}
 
开发者ID:hushengjun,项目名称:FastAndroid,代码行数:41,代码来源:SingleCallActivity.java

示例11: setPageMode

import android.view.View; //导入方法依赖的package包/类
private void setPageMode(int pageMode) {
    View selectedView = null;
    switch (pageMode) {
        case PageView.PAGE_MODE_COVER:
            readTvFlipOverCover.setSelected(true);
            selectedView = readTvFlipOverCover;
            break;
        case PageView.PAGE_MODE_SIMULATION:
            readTvFlipOverSimulation.setSelected(true);
            selectedView = readTvFlipOverSimulation;
            break;
        case PageView.PAGE_MODE_SLIDE:
            readTvFlipOverSlide.setSelected(true);
            selectedView = readTvFlipOverSlide;
            break;
        case PageView.PAGE_MODE_NONE:
            readTvFlipOverNone.setSelected(true);
            selectedView = readTvFlipOverNone;
            break;
    }
    for (View view : flipOverViews) {
        if (view != selectedView && view.isSelected()) {
            view.setSelected(false);
        }
    }
    if (pageMode != mPageView.getPageMode()) {
        mPageView.setPageAnimMode(pageMode);
        ReaderSettingManager
                .getInstance()
                .setPageMode(pageMode);
    }

}
 
开发者ID:z-chu,项目名称:FriendBook,代码行数:34,代码来源:ReaderSettingDialog.java

示例12: updateSelectTab

import android.view.View; //导入方法依赖的package包/类
private void updateSelectTab(int selectItem) {
    View preview = getItemView(preSelectItem);
    if (preview != null) {
        preview.setSelected(false);
    }
    View selectView = getItemView(selectItem);
    if (selectView != null) {
        selectView.setSelected(true);
    }
}
 
开发者ID:snowwolf10285,项目名称:PicShow-zhaipin,代码行数:11,代码来源:RecyclerIndicatorView.java

示例13: populateTabStrip

import android.view.View; //导入方法依赖的package包/类
private void populateTabStrip() {
  final PagerAdapter adapter = viewPager.getAdapter();

  for (int i = 0; i < adapter.getCount(); i++) {

    final View tabView = (tabProvider == null)
        ? createDefaultTabView(adapter.getPageTitle(i))
        : tabProvider.createTabView(tabStrip, i, adapter);

    if (tabView == null) {
      throw new IllegalStateException("tabView is null.");
    }

    if (distributeEvenly) {
      LinearLayout.LayoutParams lp = (LinearLayout.LayoutParams) tabView.getLayoutParams();
      lp.width = 0;
      lp.weight = 1;
    }

    if (internalTabClickListener != null) {
      tabView.setOnClickListener(internalTabClickListener);
    }

    tabStrip.addView(tabView);

    if (i == viewPager.getCurrentItem()) {
      tabView.setSelected(true);
    }

  }
}
 
开发者ID:devzwy,项目名称:KUtils,代码行数:32,代码来源:SmartTabLayout.java

示例14: onMuteButtonClick

import android.view.View; //导入方法依赖的package包/类
public void onMuteButtonClick(View view) {
    RongCallClient.getInstance().setEnableLocalAudio(view.isSelected());
    view.setSelected(!view.isSelected());
    muted = view.isSelected();
}
 
开发者ID:hushengjun,项目名称:FastAndroid,代码行数:6,代码来源:SingleCallActivity.java

示例15: onMuteButtonClick

import android.view.View; //导入方法依赖的package包/类
public void onMuteButtonClick(View view) {
    RongCallClient.getInstance().setEnableLocalAudio(view.isSelected());
    view.setSelected(!view.isSelected());
}
 
开发者ID:hushengjun,项目名称:FastAndroid,代码行数:5,代码来源:MultiVideoCallActivity.java


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