本文整理匯總了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);
}
}
示例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);
}
示例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);
}
示例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);
}
示例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);
}