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


Java TextView.setFocusable方法代码示例

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


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

示例1: getBook

import android.widget.TextView; //导入方法依赖的package包/类
private void getBook(Intent intent) {
    String bookId = intent.getStringExtra("bookId");
    Double price = intent.getDoubleExtra("price", 0.00);
    TextView bookIdTextView = (TextView) findViewById(bookNumberEditText);
    bookIdTextView.setText(bookId);bookIdTextView.setFocusable(false);
    TextView bookNameTextView = (TextView) findViewById(bookNameEditText);
    bookNameTextView.setText(intent.getStringExtra("bookName"));
    TextView typeTextView = (TextView) findViewById(bookTypeEditText);
    typeTextView.setText(intent.getStringExtra("type"));
    TextView authorTextView = (TextView) findViewById(bookAuthorEditText);
    authorTextView.setText(intent.getStringExtra("author"));
    TextView priceTextView = (TextView) findViewById(bookPriceEditText);
    priceTextView.setText(price.toString());
    TextView borrowerTextView = (TextView) findViewById(R.id.bookBorrowerEditText);
    borrowerTextView.setText(intent.getStringExtra("borrower"));
    TextView publicationDateTextView = (TextView) findViewById(R.id.bookDateEditText);
    publicationDateTextView.setText(intent.getStringExtra("publicationDate"));
}
 
开发者ID:thingyherb,项目名称:FamilyLibraryManager,代码行数:19,代码来源:DetailsActivity.java

示例2: addTab

import android.widget.TextView; //导入方法依赖的package包/类
/**
 * 添加指示器
 *
 * @param position
 * @param title
 */
private void addTab(final int position, CharSequence title) {
    TextView tvTab = new TextView(context);
    tvTab.setText(title);
    tvTab.setTextColor(textColor);
    tvTab.setTextSize(textSize);
    tvTab.setGravity(Gravity.CENTER);
    if(isIndicatorTextBold){
        TextPaint tp = tvTab.getPaint();
        tp.setFakeBoldText(true);
    }
    tvTab.setSingleLine();
    tvTab.setFocusable(true);
    tvTab.setOnClickListener(new OnClickListener() {
        @Override
        public void onClick(View v) {
            viewPager.setCurrentItem(position);
        }
    });
    tvTab.setPadding(indicatorMargin, 0, indicatorMargin, 0);
    container.addView(tvTab, position, expandedTabLayoutParams);
}
 
开发者ID:xfangfang,项目名称:NeuTV,代码行数:28,代码来源:TabStrip.java

示例3: 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

示例4: onCreateView

import android.widget.TextView; //导入方法依赖的package包/类
@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;
}
 
开发者ID:morogoku,项目名称:MTweaks-KernelAdiutorMOD,代码行数:26,代码来源:DescriptionFragment.java

示例5: initView

import android.widget.TextView; //导入方法依赖的package包/类
private void initView() {

        btnSave = (Button) findViewById(R.id.btnSave);
        btnSave.setOnClickListener(this);
        btndel = (Button) findViewById(R.id.btndel);
        btndel.setOnClickListener(this);
        btnupdate = (Button) findViewById(R.id.btnupdate);
        btnupdate.setOnClickListener(this);
        btnQuery = (Button) findViewById(R.id.btnQuery);
        btnQuery.setOnClickListener(this);
        tvTextView = (TextView) findViewById(R.id.tv);
        tvTextView.setFocusable(true);

        etFirstName = (AppCompatEditText) findViewById(R.id.etFirstName);
        etFirstName.setOnClickListener(this);
        btn_back = (ImageView) findViewById(R.id.btn_back);
        btn_back.setOnClickListener(this);
    }
 
开发者ID:longtaoge,项目名称:SelectName,代码行数:19,代码来源:SelectActivity.java

示例6: getcontentTextView

import android.widget.TextView; //导入方法依赖的package包/类
private View getcontentTextView() {

        countText=new TextView(getContext());

        countText.setSingleLine(true);
        countText.setGravity(Gravity.CENTER);
        countText.setMaxEms(8);
        countText.setTextSize(20);
        countText.setFocusable(false);
        LayoutParams param=getLayoutParams((getMeasuredWidth()-20)/4,getMeasuredHeight()+80);
        param.weight=3;
        param.gravity= Gravity.CENTER;
        countText.setLayoutParams(param);

        setBackgroundDrawable(countText, editTextDrawable);
//        onUpdateEditText();
        onUpdatecountText();

        return countText;
    }
 
开发者ID:fengdongfei,项目名称:CXJPadProject,代码行数:21,代码来源:DishesView.java

示例7: formatHtml

import android.widget.TextView; //导入方法依赖的package包/类
@SuppressWarnings("deprecation")
public static void formatHtml(Resources resources, TextView textView, String str) {
    if (str == null)
        return;
    str = str.trim();

    textView.setMovementMethod(MyLinkMovementMethod.a());
    textView.setFocusable(false);
    textView.setClickable(false);
    textView.setLongClickable(false);

    if (textView instanceof TweetTextView) {
        ((TweetTextView) textView).setDispatchToParent(true);
    }

    str = TweetTextView.modifyPath(str);
    Spanned span = Html.fromHtml(str);
    span = InputHelper.displayEmoji(resources, span.toString());
    textView.setText(span);
    MyURLSpan.parseLinkText(textView, span);
}
 
开发者ID:hsj-xiaokang,项目名称:OSchina_resources_android,代码行数:22,代码来源:CommentsUtil.java

示例8: addTextTab

import android.widget.TextView; //导入方法依赖的package包/类
public void addTextTab(final int position, String title) {
    TextView tab = new TextView(getContext());
    tab.setText(title);
    tab.setFocusable(true);
    tab.setGravity(Gravity.CENTER);
    tab.setSingleLine();
    tab.setTextColor(0xffffffff);
    tab.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 14);
    tab.setTypeface(Typeface.DEFAULT_BOLD);
    tab.setBackgroundDrawable(Theme.createBarSelectorDrawable(Theme.ACTION_BAR_PICKER_SELECTOR_COLOR, false));

    tab.setOnClickListener(new OnClickListener() {
        @Override
        public void onClick(View v) {
            didSelectTab(position);
        }
    });
    addView(tab);
    LayoutParams layoutParams = (LayoutParams)tab.getLayoutParams();
    layoutParams.height = LayoutHelper.MATCH_PARENT;
    layoutParams.width = 0;
    layoutParams.weight = 50;
    tab.setLayoutParams(layoutParams);

    tabCount++;
}
 
开发者ID:pooyafaroka,项目名称:PlusGram,代码行数:27,代码来源:SlidingTabView.java

示例9: initData

import android.widget.TextView; //导入方法依赖的package包/类
private void initData(String[] mVals) {

        for (int i = 0; i < mVals.length; i++) {

            tv = (TextView) mInflater.inflate(
                    R.layout.search_label_tv, mFlowLayout, false);
            tv.setTextColor(getResources().getColor(R.color.cardview_dark_background));
            tv.setText(mVals[i]);
            tv.setClickable(true);
            tv.setFocusable(true);
            mFlowLayout.addView(tv);
            final String str = tv.getText().toString().trim();
            tv.setOnClickListener(new OnClickListener() {

                @Override
                public void onClick(View view) {
                    String string = etSearch.getText().toString().trim();
                    etSearch.setText(string + " " + str);
                }
            });

        }
    }
 
开发者ID:paradoxie,项目名称:DizzyPassword,代码行数:24,代码来源:SearchView.java

示例10: initDataByName

import android.widget.TextView; //导入方法依赖的package包/类
private void initDataByName(String[] mVals) {

        for (int i = 0; i < mVals.length; i++) {

            tv = (TextView) mInflater.inflate(
                    R.layout.search_label_tv, mFlowLayout_name, false);
            tv.setTextColor(getResources().getColor(R.color.cardview_dark_background));
            tv.setText(mVals[i]);
            tv.setClickable(true);
            tv.setFocusable(true);
            mFlowLayout_name.addView(tv);
            final String str = tv.getText().toString().trim();
            tv.setOnClickListener(new OnClickListener() {

                @Override
                public void onClick(View view) {
                    String string = etSearch.getText().toString().trim();
                    etSearch.setText(string + " " + str);
                }
            });

        }
    }
 
开发者ID:paradoxie,项目名称:DizzyPassword,代码行数:24,代码来源:SearchView.java

示例11: 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

示例12: addTextTab

import android.widget.TextView; //导入方法依赖的package包/类
public void addTextTab(final int position, String title) {
    TextView tab = new TextView(getContext());
    tab.setTypeface(FontManager.instance().getTypeface());
    tab.setText(title);
    tab.setFocusable(true);
    tab.setGravity(Gravity.CENTER);
    tab.setSingleLine();
    tab.setTextColor(0xffffffff);
    tab.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 14);
    tab.setTypeface(Typeface.DEFAULT_BOLD);
    tab.setBackgroundDrawable(Theme.createBarSelectorDrawable(Theme.ACTION_BAR_PICKER_SELECTOR_COLOR, false));

    tab.setOnClickListener(new OnClickListener() {
        @Override
        public void onClick(View v) {
            didSelectTab(position);
        }
    });
    addView(tab);
    LayoutParams layoutParams = (LayoutParams)tab.getLayoutParams();
    layoutParams.height = LayoutHelper.MATCH_PARENT;
    layoutParams.width = 0;
    layoutParams.weight = 50;
    tab.setLayoutParams(layoutParams);

    tabCount++;
}
 
开发者ID:MLNO,项目名称:airgram,代码行数:28,代码来源:SlidingTabView.java

示例13: 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

示例14: 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

示例15: setLikeUsers

import android.widget.TextView; //导入方法依赖的package包/类
public void setLikeUsers(Context contet, TextView likeUser, boolean limit) {
    // 构造多个超链接的html, 通过选中的位置来获取用户名
    if (getLikeCount() > 0 && getLikeUser() != null
            && !getLikeUser().isEmpty()) {
        likeUser.setVisibility(View.VISIBLE);
        likeUser.setMovementMethod(LinkMovementMethod.getInstance());
        likeUser.setFocusable(false);
        likeUser.setLongClickable(false);
        likeUser.setText(addClickablePart(contet, limit), BufferType.SPANNABLE);
    } else {
        likeUser.setVisibility(View.GONE);
        likeUser.setText("");
    }
    likeUser.setVisibility(View.GONE);
}
 
开发者ID:hsj-xiaokang,项目名称:OSchina_resources_android,代码行数:16,代码来源:Tweet.java


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