本文整理汇总了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);
}
}
示例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++;
}
}
示例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);
}
}
}
示例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++;
}
}
}
示例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);
}
}
});
}
示例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());
}
示例7: onFabClick
import android.view.View; //导入方法依赖的package包/类
private void onFabClick(View v) {
if (v.isSelected()) {
hideMenu();
} else {
showMenu();
}
v.setSelected(!v.isSelected());
}
示例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);
}
}
}
示例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);
}
}
}
}
示例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);
}
}
示例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);
}
}
示例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);
}
}
示例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);
}
}
}
示例14: onMuteButtonClick
import android.view.View; //导入方法依赖的package包/类
public void onMuteButtonClick(View view) {
RongCallClient.getInstance().setEnableLocalAudio(view.isSelected());
view.setSelected(!view.isSelected());
muted = view.isSelected();
}
示例15: onMuteButtonClick
import android.view.View; //导入方法依赖的package包/类
public void onMuteButtonClick(View view) {
RongCallClient.getInstance().setEnableLocalAudio(view.isSelected());
view.setSelected(!view.isSelected());
}