當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。