Java Code Examples for android.widget.TextView.setSelected()

The following are Jave code examples for showing how to use setSelected() of the android.widget.TextView class. You can vote up the examples you like. Your votes will be used in our system to get more good examples.
+ Save this method
Example 1
Project: miaosou   File: AnimationNewActivity.java   View Source Code Vote up 6 votes
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_animation_new);
    tvNewNews = (TextView) findViewById(R.id.tv_bar_news_news);
    tvNewNews.setSelected(true);
    tvNewNews.setOnClickListener(this);
    tvhotNews = (TextView) findViewById(R.id.tv_bar_news_hot);
    tvhotNews.setOnClickListener(this);
    tvtuiNews = (TextView) findViewById(R.id.tv_bar_news_tui);
    tvtuiNews.setOnClickListener(this);
    vpNews = (ViewPager) findViewById(R.id.vp_news);
    newsFragmentLists = new ArrayList<>();
    newNewsFragment = NewsFragment.newNewsFragment(NewsFragment.NEWSNEWS);
    hotNewsFragment = NewsFragment.newNewsFragment(NewsFragment.NEWSHOT);
    tuiNewsFragment = NewsFragment.newNewsFragment(NewsFragment.NEWSTUI);
    newsFragmentLists.add(newNewsFragment);
    newsFragmentLists.add(hotNewsFragment);
    newsFragmentLists.add(tuiNewsFragment);
    newsViewPagerAdapter = new NewsViewPagerAdapter(getSupportFragmentManager(),newsFragmentLists);
    vpNews.setAdapter(newsViewPagerAdapter);
    vpNews.addOnPageChangeListener(this);
    vpNews.setOffscreenPageLimit(3);
}
 
Example 2
Project: Musicoco   File: RecentMostPlayController.java   View Source Code Vote up 6 votes
public void initView() {
    mType = (TextView) activity.findViewById(R.id.rmp_type);

    mName = (TextView) activity.findViewById(R.id.rmp_info_name);
    // 跑马灯
    mName.setSelected(true);
    mArts = (TextView) activity.findViewById(R.id.rmp_info_arts);
    mRemark = (TextView) activity.findViewById(R.id.rmp_info_remark);

    mPlayTime = (TextView) activity.findViewById(R.id.rmp_play_time);
    mPlayTimeL = (TextView) activity.findViewById(R.id.rmp_l_time);
    mPlayTimeR = (TextView) activity.findViewById(R.id.rmp_r_time);

    mShowMore = (TextView) activity.findViewById(R.id.rmp_see_more);
    mLine = activity.findViewById(R.id.rmp_line);
    mInfoLine = activity.findViewById(R.id.rmp_info_line);
    mImage = (ImageView) activity.findViewById(R.id.rmp_image);
    mInfoContainer = activity.findViewById(R.id.rmp_info_container);
    mContainer = activity.findViewById(R.id.rmp_container);

    mShowMore.setOnClickListener(this);
    mContainer.setOnClickListener(this);
}
 
Example 3
Project: Musicoco   File: BottomNavigationController.java   View Source Code Vote up 6 votes
private void initSelfViews() {

        mAlbum = (ImageView) activity.findViewById(R.id.list_album);
        mName = (TextView) activity.findViewById(R.id.list_name);
        // 跑马灯
        mName.setSelected(true);
        mArts = (TextView) activity.findViewById(R.id.list_arts);
        mPlay = (PlayView) activity.findViewById(R.id.list_play);
        mShowList = (ImageButton) activity.findViewById(R.id.list_list);
        mContainer = activity.findViewById(R.id.list_bottom_nav_container);
        mProgress = activity.findViewById(R.id.list_progress);
        mProgressBG = activity.findViewById(R.id.list_progress_bg);

        mContainer.setOnClickListener(this);
        mShowList.setOnClickListener(this);
        mPlay.setOnClickListener(this);

    }
 
Example 4
Project: Kasumi   File: MainActivity.java   View Source Code Vote up 6 votes
public void changeFolder(long id) {
    KRFAM.log("MainActivity.java > changeFolder");
    CURRENT_FOLDER = id;
    KRFAM.sharedPreferences.edit().putLong("CURRENT_FOLDER", CURRENT_FOLDER).commit();
    CURRENT_OFFSET = 0;
    TextView currentFolder_textView = (TextView) findViewById(R.id.folder_currentFolder);
    TextView currentCount_textView = (TextView) findViewById(R.id.folder_currentCount);
    if (CURRENT_FOLDER == -1) {
        getSupportActionBar().setDisplayHomeAsUpEnabled(false);
        findViewById(R.id.folder_currentWrapper).setVisibility(View.GONE);
    } else {
        getSupportActionBar().setDisplayHomeAsUpEnabled(true);
        findViewById(R.id.folder_currentWrapper).setVisibility(View.VISIBLE);
        currentFolder_textView.setText(getPathToFolder(CURRENT_FOLDER));
        currentFolder_textView.setSelected(true);
        currentCount_textView.setText("" + db.countAccounts(CURRENT_FOLDER, "", false));
    }
    LinearLayout searchBar = (LinearLayout) findViewById(R.id.view_search);
    searchBar.setVisibility(View.GONE);
    getCurrentPage();
}
 
Example 5
Project: MTweaks-KernelAdiutorMOD   File: DescriptionFragment.java   View Source Code Vote up 6 votes
@Nullable
@Override
public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container,
                         @Nullable Bundle savedInstanceState) {
    View rootView = inflater.inflate(R.layout.fragment_description, container, false);

    mTitleView = (TextView) rootView.findViewById(R.id.title);
    mSummaryView = (TextView) rootView.findViewById(R.id.summary);

    if (Utils.isTv(getActivity())) {
        mSummaryView.setFocusable(true);
    } else {
        mTitleView.setTextIsSelectable(true);
        mSummaryView.setTextIsSelectable(true);
    }

    mSummaryView.setSelected(true);
    mSummaryView.setMovementMethod(LinkMovementMethod.getInstance());

    mTitle = getArguments().getCharSequence("title");
    mSummary = getArguments().getCharSequence("summary");

    refresh();
    return rootView;
}
 
Example 6
Project: ImageClassify   File: HomeFragmentPresenter.java   View Source Code Vote up 6 votes
/**
 * 选择任务图片数量,并设置相应的TextView背景
 */
@Override
public void selectTaskImgAmount(TextView times_10,TextView times_20,TextView times_30,int task_img_amount) {
    initTaskButtonBg(times_10,times_20,times_30);
    switch (task_img_amount){
        case 10:
            times_10.setSelected(true);
            times_10.setTextColor(mContext.getResources().getColor(R.color.colorWhite));
            break;
        case 20:
            times_20.setSelected(true);
            times_20.setTextColor(mContext.getResources().getColor(R.color.colorWhite));
            break;
        case 30:
            times_30.setSelected(true);
            times_30.setTextColor(mContext.getResources().getColor(R.color.colorWhite));
            break;
    }
}
 
Example 7
Project: KernelAdiutor-Mod   File: DescriptionFragment.java   View Source Code Vote up 6 votes
@Nullable
@Override
public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container,
                         @Nullable Bundle savedInstanceState) {
    View rootView = inflater.inflate(R.layout.fragment_description, container, false);

    mTitleView = (TextView) rootView.findViewById(R.id.title);
    mSummaryView = (TextView) rootView.findViewById(R.id.summary);

    if (Utils.isTv(getActivity())) {
        mSummaryView.setFocusable(true);
    } else {
        mTitleView.setTextIsSelectable(true);
        mSummaryView.setTextIsSelectable(true);
    }

    mSummaryView.setSelected(true);
    mSummaryView.setMovementMethod(LinkMovementMethod.getInstance());

    mTitle = getArguments().getCharSequence("title");
    mSummary = getArguments().getCharSequence("summary");

    refresh();
    return rootView;
}
 
Example 8
Project: LiuAGeAndroid   File: OptionalGridViewAdapter.java   View Source Code Vote up 6 votes
@Override
public View getView(int position, View convertView, ViewGroup parent) {
    View view = LayoutInflater.from(context).inflate(R.layout.item_column_item, null);
    item_text = (TextView) view.findViewById(R.id.text_item);
    String className = getItem(position).getClassname();
    item_text.setText(className);
    if (isSelected) {
        if (position == 0) {
            item_text.setEnabled(false);
        }
    }
    if (!isVisible && (position == -1 + optionalList.size())) {
        item_text.setText("");
        item_text.setSelected(true);
        item_text.setEnabled(true);
    }
    if (remove_position == position) {
        item_text.setText("");
    }
    return view;
}
 
Example 9
Project: GitHub   File: AdapterMediaQuality.java   View Source Code Vote up 5 votes
@Override
public View getView(final int i, View view, ViewGroup parent) {
    if (view == null) {
        view = LayoutInflater.from(mContext).inflate(R.layout.adapter_media_quality, parent, false);
    }
    TextView qualityDesc = (TextView) view.findViewById(R.id.tv_media_quality);
    qualityDesc.setText(mDatas.get(i).getDesc());
    qualityDesc.setSelected(mDatas.get(i).isSelect());
    return view;
}
 
Example 10
Project: pracler   File: MusicController.java   View Source Code Vote up 5 votes
private void viewInitialize()
{
    LayoutInflater inflater = (LayoutInflater) getContext().getSystemService(Context.LAYOUT_INFLATER_SERVICE);
    mainView = inflater.inflate(R.layout.view_music_controller, null);

    addView(mainView);
    songAlbumImageView = (ImageView) mainView.findViewById(R.id.imageView);
    songTitleTextView = (TextView)  mainView.findViewById(R.id.titleview);
    songTitleTextView.setSelected(true);
    songInformationTextView = (TextView)  mainView.findViewById(R.id.nameView);
}
 
Example 11
Project: Hotspot-master-devp   File: EasySwitcher.java   View Source Code Vote up 5 votes
private View getItemView(int position){
    TextView textView = new TextView(mContext);
    textView.setTextAppearance(mContext, R.style.switcher_item_text_style);
    LinearLayout.LayoutParams layoutParams = new LinearLayout.LayoutParams(LinearLayout.LayoutParams.MATCH_PARENT,
            DensityUtil.dip2px(mContext,40));
    textView.setLayoutParams(layoutParams);
    textView.setSelected(position == mDefaultSelection);
    textView.setGravity(Gravity.CENTER);
    textView.setText(mAllItemArray.get(position));
    textView.setTextSize(TypedValue.COMPLEX_UNIT_SP, 12.0f);
    textView.setOnClickListener(mItemOnClickListener);
    textView.setTag(position);
    return textView;
}
 
Example 12
Project: Dampp   File: MatchesAdapter.java   View Source Code Vote up 5 votes
public ViewHolder(View itemView) {
    super(itemView);

    imageView = (CircleImageView) itemView.findViewById(R.id.profile_image);
    usernameTextView = (TextView) itemView.findViewById(R.id.username);
    usernameTextView.setSelected(true);

}
 
Example 13
Project: ImageClassify   File: HomeFragmentPresenter.java   View Source Code Vote up 5 votes
/**
 * 将所有图片次数TextView初始化为为选中状态
 * @param times_10
 * @param times_20
 * @param times_30
 */
private void initTaskButtonBg(TextView times_10,TextView times_20,TextView times_30) {
    times_10.setSelected(false);
    times_10.setTextColor(mContext.getResources().getColor(R.color.colorTheme));
    times_20.setSelected(false);
    times_20.setTextColor(mContext.getResources().getColor(R.color.colorTheme));
    times_30.setSelected(false);
    times_30.setTextColor(mContext.getResources().getColor(R.color.colorTheme));
}
 
Example 14
Project: LiuAGeAndroid   File: DragGridViewAdapter.java   View Source Code Vote up 5 votes
@Override
public View getView(int position, View convertView, ViewGroup parent) {
    View view = LayoutInflater.from(context).inflate(R.layout.item_column_item, null);
    item_text = (TextView) view.findViewById(R.id.text_item);
    String className = getItem(position).getClassname();
    item_text.setText(className);
    if (isUser) {
        if (position == 0) {
            item_text.setEnabled(false);
        }
    }
    if (isChanged && (position == holdPosition) && !isItemShow) {
        item_text.setText("");
        item_text.setSelected(true);
        item_text.setEnabled(true);
        isChanged = false;
    }
    if (!isVisible && (position == -1 + selectedList.size())) {
        item_text.setText("");
        item_text.setSelected(true);
        item_text.setEnabled(true);
    }
    if (remove_position == position) {
        item_text.setText("");
    }
    return view;
}
 
Example 15
Project: UiLib   File: EasySwitcher.java   View Source Code Vote up 5 votes
private View getItemView(int position){
    TextView textView = new TextView(mContext);
    textView.setTextAppearance(mContext, R.style.switcher_item_text_style);
    LayoutParams layoutParams = new LayoutParams(LayoutParams.MATCH_PARENT,
            DensityUtil.dip2px(mContext, 35));
    textView.setLayoutParams(layoutParams);
    textView.setSelected(position == mDefaultSelection);
    textView.setGravity(Gravity.CENTER);
    textView.setText(mAllItemArray.get(position));
    textView.setTextSize(TypedValue.COMPLEX_UNIT_SP, 12.0f);
    textView.setOnClickListener(mItemOnClickListener);
    textView.setTag(position);
    return textView;
}
 
Example 16
Project: android-project-gallery   File: XPreferenceExtra.java   View Source Code Vote up 5 votes
public void onXPreferenceChanged(XPreference preference, boolean isChecked)
{
	TextView checkbox = preference.getIndicator();
	if (onXPreferenceSelected(preference, isChecked) && !isChecked)
	{
		checkbox.setSelected(true);
	}
	else
	{
		checkbox.setSelected(false);
	}
}
 
Example 17
Project: youtube_background_android   File: MainActivity.java   View Source Code Vote up 4 votes
private void clearTitleTextView() {
    mTitleTextView = (TextView) findViewById(R.id.title);
    mTitleTextView.setText("");
    fragmentName = "";
    mTitleTextView.setSelected(true);
}
 
Example 18
Project: android-training-2017   File: CustomSpinner.java   View Source Code Vote up 4 votes
@Override
public void setSelected(boolean selected) {
    super.setSelected(selected);
    text = (TextView) findViewById(R.id.text);
    text.setSelected(selected);
}
 
Example 19
Project: letv   File: LivePlayerController.java   View Source Code Vote up 4 votes
private void setBtnLevelStatus(int num) {
    boolean z;
    boolean z2 = true;
    this.mBtnLevelSmooth.setSelected(num == 0);
    TextView textView = this.mBtnLevelSmooth;
    if (num != 0) {
        z = true;
    } else {
        z = false;
    }
    textView.setEnabled(z);
    textView = this.mBtnLevelStandard;
    if (num == 1) {
        z = true;
    } else {
        z = false;
    }
    textView.setSelected(z);
    textView = this.mBtnLevelStandard;
    if (num != 1) {
        z = true;
    } else {
        z = false;
    }
    textView.setEnabled(z);
    textView = this.mBtnLevelHigh;
    if (num == 2) {
        z = true;
    } else {
        z = false;
    }
    textView.setSelected(z);
    textView = this.mBtnLevelHigh;
    if (num != 2) {
        z = true;
    } else {
        z = false;
    }
    textView.setEnabled(z);
    textView = this.mBtnLevelSuper;
    if (num == 3) {
        z = true;
    } else {
        z = false;
    }
    textView.setSelected(z);
    textView = this.mBtnLevelSuper;
    if (num != 3) {
        z = true;
    } else {
        z = false;
    }
    textView.setEnabled(z);
    textView = this.mBtnLevel2K;
    if (num == 4) {
        z = true;
    } else {
        z = false;
    }
    textView.setSelected(z);
    textView = this.mBtnLevel2K;
    if (num != 4) {
        z = true;
    } else {
        z = false;
    }
    textView.setEnabled(z);
    textView = this.mBtnLevel4K;
    if (num == 5) {
        z = true;
    } else {
        z = false;
    }
    textView.setSelected(z);
    TextView textView2 = this.mBtnLevel4K;
    if (num == 5) {
        z2 = false;
    }
    textView2.setEnabled(z2);
    this.mCurrentSelectLevelPos = num;
}
 
Example 20
Project: AndroidBackendlessChat   File: ChatSDKEditProfileActivity.java   View Source Code Vote up 3 votes
private void setSelected(TextView textView, boolean selected){
    
    textView.setSelected(selected);
    
    if (selected)
        textView.setTextColor(getResources().getColor(R.color.white));
    else
        textView.setTextColor(getResources().getColor(R.color.dark_gray));

}