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


Java TextView.setFocusableInTouchMode方法代码示例

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


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

示例1: onResume

import android.widget.TextView; //导入方法依赖的package包/类
@Override
public void onResume()
{
    super.onResume();
    final Activity activity = getActivity();
    final boolean tcAccepted = ConfigHelper.isTCAccepted(activity);
    if (tcAccepted)
    {
        final TextView buttonTermsAccept = (TextView) view.findViewById(R.id.termsAcceptButton);
        buttonTermsAccept.setFocusable(true); //set focus on button so that terms can be accepted on Android TV like devices (5-way-navigation)
        buttonTermsAccept.setFocusableInTouchMode(false);
        buttonTermsAccept.requestFocus();
        buttonTermsAccept.setText(R.string.terms_accept_button_continue);
        view.findViewById(R.id.termsAcceptText).setVisibility(View.GONE);
    }
}
 
开发者ID:rtr-nettest,项目名称:open-rmbt,代码行数:17,代码来源:RMBTTermsCheckFragment.java

示例2: onCreateViewHolder

import android.widget.TextView; //导入方法依赖的package包/类
@Override
public ViewHolder onCreateViewHolder(ViewGroup parent) {
    TextView view = new TextView(parent.getContext());

    Resources res = parent.getResources();
    int width = res.getDimensionPixelSize(R.dimen.grid_item_width);
    int height = res.getDimensionPixelSize(R.dimen.grid_item_height);

    view.setLayoutParams(new ViewGroup.LayoutParams(width, height));
    view.setFocusable(true);
    view.setFocusableInTouchMode(true);
    view.setBackgroundColor(ContextCompat.getColor(parent.getContext(),
            R.color.default_background));
    view.setTextColor(Color.WHITE);
    view.setGravity(Gravity.CENTER);
    return new ViewHolder(view);
}
 
开发者ID:nejtv,项目名称:androidtv-sample,代码行数:18,代码来源:GridItemPresenter.java

示例3: onCreateViewHolder

import android.widget.TextView; //导入方法依赖的package包/类
@Override
public ViewHolder onCreateViewHolder(ViewGroup parent) {
    TextView view = new TextView(parent.getContext());
    view.setLayoutParams(new ViewGroup.LayoutParams(GRID_ITEM_WIDTH, GRID_ITEM_HEIGHT));
    view.setFocusable(true);
    view.setFocusableInTouchMode(true);
    view.setBackgroundColor(getResources().getColor(R.color.default_background));
    view.setTextColor(Color.WHITE);
    view.setGravity(Gravity.CENTER);
    return new ViewHolder(view);
}
 
开发者ID:bassaer,项目名称:HelloTV,代码行数:12,代码来源:MainFragment.java

示例4: onCreateViewHolder

import android.widget.TextView; //导入方法依赖的package包/类
@Override
public ViewHolder onCreateViewHolder(ViewGroup parent) {
	TextView view = new TextView(parent.getContext());
	view.setLayoutParams(new ViewGroup.LayoutParams(GRID_ITEM_WIDTH, GRID_ITEM_HEIGHT));
	view.setFocusable(true);
	view.setFocusableInTouchMode(true);
	view.setBackgroundColor(getResources().getColor(R.color.default_background));
	view.setTextColor(Color.WHITE);
	view.setGravity(Gravity.CENTER);
	return new ViewHolder(view);
}
 
开发者ID:fasteque,项目名称:leanback-extensions,代码行数:12,代码来源:MainFragment.java

示例5: onCreateViewHolder

import android.widget.TextView; //导入方法依赖的package包/类
@Override
public ViewHolder onCreateViewHolder(ViewGroup parent) {

    mDefaultBackgroundColor =
            ContextCompat.getColor(parent.getContext(), R.color.default_background);
    mSelectedBackgroundColor =
            ContextCompat.getColor(parent.getContext(), R.color.selected_background);

    TextView view = new AppCompatTextView(parent.getContext()) {
        @Override
        public void setSelected(boolean selected) {
            updateGridItemBackgroundColor(this, selected);
            super.setSelected(selected);
        }
    };

    Resources res = parent.getResources();
    int width = res.getDimensionPixelSize(R.dimen.grid_item_width);
    int height = res.getDimensionPixelSize(R.dimen.grid_item_height);

    view.setLayoutParams(new ViewGroup.LayoutParams(width, height));
    view.setFocusable(true);
    view.setFocusableInTouchMode(true);
    view.setBackgroundColor(ContextCompat.getColor(parent.getContext(),
            R.color.default_background));
    view.setTextColor(Color.WHITE);
    view.setGravity(Gravity.CENTER);
    return new ViewHolder(view);
}
 
开发者ID:ad-on-is,项目名称:chilly,代码行数:30,代码来源:GridItemPresenter.java


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