當前位置: 首頁>>代碼示例>>Java>>正文


Java TextView.setOnClickListener方法代碼示例

本文整理匯總了Java中android.widget.TextView.setOnClickListener方法的典型用法代碼示例。如果您正苦於以下問題:Java TextView.setOnClickListener方法的具體用法?Java TextView.setOnClickListener怎麽用?Java TextView.setOnClickListener使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在android.widget.TextView的用法示例。


在下文中一共展示了TextView.setOnClickListener方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: onCreate

import android.widget.TextView; //導入方法依賴的package包/類
@Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main2);

        listView = (ListView) findViewById(R.id.listview);
        TextView textView = (TextView) findViewById(R.id.secondtext);
        textView.setOnClickListener(v -> {
//                    RobustModify.modify();
                    Log.d("robust", " onclick  in Listener");
                }
        );
        //change text on the  SecondActivity
        textView.setText(getTextInfo());

        //test array
        BaseAdapter adapter = new ArrayAdapter<>(this, android.R.layout.simple_expandable_list_item_1, multiArr);
        listView.setAdapter(adapter);
    }
 
開發者ID:Meituan-Dianping,項目名稱:Robust,代碼行數:20,代碼來源:SecondActivity.java

示例2: onCreate

import android.widget.TextView; //導入方法依賴的package包/類
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_lost_view);

    final TextView lost_view_back = (TextView) findViewById(R.id.lost_view_back);
    lost_view_list = (ListView) findViewById(R.id.lost_view_list);
    final Animation fade_in_anim = AnimationUtils.loadAnimation(getApplicationContext(), R.anim.fade_in);
    lost_view_list.setAnimation(fade_in_anim);
    ArrayAdapter<String> adapter = new ArrayAdapter(this, android.R.layout.simple_spinner_item, displayLostItem());
    lost_view_list.setAdapter(adapter);
    lost_view_back.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View view) {
            goToMain();
        }
    });
}
 
開發者ID:IvoryCandy,項目名稱:Plus1s,代碼行數:19,代碼來源:LostViewActivity.java

示例3: findViews

import android.widget.TextView; //導入方法依賴的package包/類
/**
 * 初始化viwe
 */
private void findViews() {
    LayoutInflater inflater = (LayoutInflater) getContext()
            .getSystemService(Context.LAYOUT_INFLATER_SERVICE);
    inflater.inflate(R.layout.item_expand_collapse, this);
    mTvContent = (TextView) findViewById(R.id.expandable_text);
    mTvContent.setOnClickListener(this);
    mTvExpandCollapse = (TextView) findViewById(R.id.expand_collapse);
    setDrawbleAndText();
    mTvExpandCollapse.setOnClickListener(this);

    mTvContent.setTextColor(contentTextColor);
    mTvContent.getPaint().setTextSize(contentTextSize);

    mTvExpandCollapse.setTextColor(collapseExpandTextColor);
    mTvExpandCollapse.getPaint().setTextSize(collapseExpandTextSize);

    //設置收起展開位置:左或者右
    LayoutParams lp = new LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT);
    lp.gravity = grarity;
    mTvExpandCollapse.setLayoutParams(lp);
}
 
開發者ID:mangestudio,項目名稱:GCSApp,代碼行數:25,代碼來源:ExpandableTextView2.java

示例4: initActionbar

import android.widget.TextView; //導入方法依賴的package包/類
private void initActionbar() {
    TextView toolbarView = findView(R.id.action_bar_right_clickable_textview);
    toolbarView.setText(R.string.add);
    toolbarView.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            ContactSelectActivity.Option option = new ContactSelectActivity.Option();
            option.title = "選擇黑名單";
            option.maxSelectNum = 1;
            ArrayList<String> excludeAccounts = new ArrayList<>();
            for (UserInfoProvider.UserInfo user : data) {
                if (user != null) {
                    excludeAccounts.add(user.getAccount());
                }
            }
            option.itemFilter = new ContactIdFilter(excludeAccounts, true);
            NimUIKit.startContactSelect(BlackListActivity.this, option, REQUEST_CODE_BLACK);
        }
    });
}
 
開發者ID:newDeepLearing,項目名稱:decoy,代碼行數:21,代碼來源:BlackListActivity.java

示例5: generateTitleView

import android.widget.TextView; //導入方法依賴的package包/類
private void generateTitleView() {
    if (getChildCount() > 0)
        this.removeAllViews();
    int count = mTitles.length;

    setWeightSum(count);
    for (int i = 0; i < count; i++) {
        TextView tv = new TextView(getContext());
        LayoutParams lp = new LayoutParams(0, LayoutParams.MATCH_PARENT);
        lp.weight = 1;
        tv.setGravity(Gravity.CENTER);
        tv.setTextColor(COLOR_TEXT_NORMAL);
        tv.setText(mTitles[i]);
        tv.setTextSize(TypedValue.COMPLEX_UNIT_SP, 16);
        tv.setLayoutParams(lp);
        tv.setOnClickListener(new OnClickListener() {
            @Override
            public void onClick(View v) {

            }
        });
        addView(tv);
    }
}
 
開發者ID:wuhighway,項目名稱:DailyStudy,代碼行數:25,代碼來源:SimpleViewPagerIndicator.java

示例6: onCreate

import android.widget.TextView; //導入方法依賴的package包/類
@Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_create_table);
        initToolBar();
        showOrHideToolBarNavigation(true);
//        initData();
        mBtCreateTable = (TextView) findViewById(R.id.bt_create);
        mProgressBar = (ProgressBar) findViewById(R.id.progressbar);
        mBtCreateTable.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                mProgressBar.setProgress(0);
                initData();
            }
        });
    }
 
開發者ID:FallenCrood,項目名稱:Review-,代碼行數:18,代碼來源:CreateTableActivity.java

示例7: initTextOut

import android.widget.TextView; //導入方法依賴的package包/類
private void initTextOut() {
    textOut = (TextView) findViewById(R.id.text_out);
    AutofitHelper.create(textOut).setMaxLines(6);
    textOut.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            ClipboardManager cmb = (ClipboardManager) v.getContext().getSystemService(Context.CLIPBOARD_SERVICE);
            cmb.setText(textOut.getText());
            Snackbar.make(v, "已複製轉換結果", Snackbar.LENGTH_SHORT).show();
        }
    });
}
 
開發者ID:HK-SHAO,項目名稱:DarkCalculator,代碼行數:13,代碼來源:CapitalMoneyActivity.java

示例8: initView

import android.widget.TextView; //導入方法依賴的package包/類
private void initView() {
        setOrientation(VERTICAL);
        LayoutInflater.from(getContext()).inflate(R.layout.share_fragment_item_content_layout, this);
        contentText = (TextView) findViewById(R.id.tv_url_text_content);
        contentText.setTextSize(PixelUtil.dp2px(16));
        contentText.setTextColor(getResources().getColor(R.color.base_color_text_black));
        cover = (TextView) findViewById(R.id.tv_url_text_cover);
        cover.setTextColor(getResources().getColor(R.color.base_color_text_black));
        contentText.setMaxLines(maxLine);
        cover.setOnClickListener(new OnClickListener() {
                @Override
                public void onClick(View v) {
                        if (cover.getText().toString().trim().equals("全文")) {
                                contentText.setMaxLines(Integer.MAX_VALUE);
                                cover.setText("收起");
                                if (mOnTextExpandStatusChangeListener != null) {
                                        mOnTextExpandStatusChangeListener.onExpandStatusChanged(false);
                                }
                        } else if (cover.getText().toString().trim().equals("收起")) {
                                contentText.setMaxLines(maxLine);
                                cover.setText("全文");
                                if (mOnTextExpandStatusChangeListener != null) {
                                        mOnTextExpandStatusChangeListener.onExpandStatusChanged(true);
                                }
                        }
                }
        });
}
 
開發者ID:HelloChenJinJun,項目名稱:TestChat,代碼行數:29,代碼來源:UrlTextView.java

示例9: bindData

import android.widget.TextView; //導入方法依賴的package包/類
public void bindData(InfoBean bean) {

        TextView tvSetting = (TextView) findViewByResName(bean.type().ui().resNameEdit(), "id");
        if (tvSetting != null) {
            tvSetting.setOnClickListener(new View.OnClickListener() {
                @Override
                public void onClick(View v) {

                }
            });
        }

        if (bean.type().id().matches("1[0-9]*")) {
            tvDetailTitle.setText("火車票");
        }

        for (ConceptDesc description : bean.type().conceptDescs()) {
            String resName = description.identifier();
            String defType = description.resType();
            if (resName != null) {
                TextView tv = (TextView) findViewByResName(resName, defType);
                String value = bean.valueOfConcept(description.concept());
                if (tv != null && value != null) {
                    tv.setText(value);
                } else {
                    if (tv != null) {
                        tv.setVisibility(View.INVISIBLE);
                    }
                    if (tvSetting != null) {
                        tvSetting.setVisibility(View.VISIBLE);
                    }
                }
                if (description.concept().id() == 1) {
                    tvDetailTitleContent.setText(value);
                }
            }
        }
    }
 
開發者ID:jonashao,項目名稱:Samantha,代碼行數:39,代碼來源:TicketViewHolder.java

示例10: onCreateView

import android.widget.TextView; //導入方法依賴的package包/類
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup parent, Bundle savedInstanceState) {
    View v = inflater.inflate(R.layout.fragment_acerca_de, parent, false);

    textViewLineasAccion = (TextView) v.findViewById(R.id.enlace_lineas_de_accion);
    textViewDiagnosticoJuvenil = (TextView) v.findViewById(R.id.enlace_diagnostico_juvenil);
    textViewEncuestaJuventud = (TextView) v.findViewById(R.id.enlace_encuesta_de_juventud);
    textViewDirectorio = (TextView) v.findViewById(R.id.enlace_directorio);

    textViewLineasAccion.setOnClickListener((View) -> {
        enlace(getString(R.string.fragment_acercade_link_lineas_accion));
    });

    textViewDiagnosticoJuvenil.setOnClickListener((View) -> {
        enlace(getString(R.string.fragment_acercade_link_diagnostico));
    });

    textViewEncuestaJuventud.setOnClickListener((View) -> {
        enlace(getString(R.string.fragment_acerdade_link_encuesta));
    });

    textViewDirectorio.setOnClickListener((View) -> {
        enlace(getString(R.string.fragment_acercade_link_directorio));
    });

    return v;
}
 
開發者ID:ur13l,項目名稱:Guanajoven,代碼行數:28,代碼來源:AcercaDeFragment.java

示例11: show

import android.widget.TextView; //導入方法依賴的package包/類
/**
 * 顯示對話框
 */
@SuppressLint("InflateParams")
public void show() {

    mainView.removeAllViews();
    if (!TextUtils.isEmpty(title)) {
        mainView.addView(dialogTitle);
        dialogTitle.setVisibility(View.VISIBLE);
        dialogTitle.setText(title);
    }
    if (!TextUtils.isEmpty(message)) {
        mainView.addView(dialogText);
        dialogText.setVisibility(View.VISIBLE);
        dialogText.setText(message);
    }
    if (listView != null) {
        mainView.addView(listView);
    }
    //隻創建了一個按鈕
    if (btnNames.size() == 1) {
        singleBtn = (LinearLayout) LayoutInflater.from(context).inflate(R.layout.kf5_message_box_single_btn, null);
        TextView dialogBtn = (TextView) singleBtn.findViewById(R.id.kf5_dialogBtn);
        dialogBtn.setText(btnNames.get(0));
        dialogBtn.setOnClickListener(new ClickListener(0));
        mainView.addView(singleBtn);
    } else if (btnNames.size() == 2) {
        doubleBtn = (LinearLayout) LayoutInflater.from(context).inflate(R.layout.kf5_message_box_double_btn, null);
        TextView leftBtn = (TextView) doubleBtn.findViewById(R.id.kf5_dialogLeftBtn);
        TextView rightBtn = (TextView) doubleBtn.findViewById(R.id.kf5_dialogRightBtn);
        leftBtn.setText(btnNames.get(0));
        leftBtn.setOnClickListener(new ClickListener(0));
        rightBtn.setText(btnNames.get(1));
        rightBtn.setOnClickListener(new ClickListener(1));
        mainView.addView(doubleBtn);
    }
    dialog.setContentView(mainView);
    dialog.show();

}
 
開發者ID:Zyj163,項目名稱:yyox,代碼行數:42,代碼來源:DialogBox.java

示例12: initActionSheetViews

import android.widget.TextView; //導入方法依賴的package包/類
protected void initActionSheetViews(LayoutInflater layoutInflater) {
    ViewGroup viewGroup = (ViewGroup) layoutInflater.inflate(R.layout.layout_alertview_actionsheet,contentContainer);
    initHeaderView(viewGroup);

    initListView();
    TextView tvAlertCancel = (TextView) contentContainer.findViewById(R.id.tvAlertCancel);
    if(cancel != null){
        tvAlertCancel.setVisibility(View.VISIBLE);
        tvAlertCancel.setText(cancel);
    }
    tvAlertCancel.setOnClickListener(new OnTextClickListener(CANCELPOSITION));
}
 
開發者ID:devzwy,項目名稱:NeiHanDuanZiTV,代碼行數:13,代碼來源:AlertView.java

示例13: init

import android.widget.TextView; //導入方法依賴的package包/類
private void init(Context context) {
	tvEmpty = new TextView(context);
	int tvEmptySize = getResources().getDimensionPixelSize(ResHelper.getResId(context, "dimen", "bbs_empty_view_txt_size"));
	tvEmpty.setTextSize(TypedValue.COMPLEX_UNIT_PX, tvEmptySize);
	int padding = ResHelper.dipToPx(context, 10);
	tvEmpty.setPadding(padding, padding, padding, padding);
	int tvEmptyColor = getResources().getColor(ResHelper.getColorRes(context, "bbs_empty_view_txt_color"));
	tvEmpty.setTextColor(tvEmptyColor);
	tvEmpty.setId(ResHelper.getIdRes(context, "tvEmpty"));

	ivEmpty = new ImageView(context);
	ivEmpty.setScaleType(ImageView.ScaleType.CENTER);

	LayoutParams rlp = new LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT);
	rlp.addRule(CENTER_IN_PARENT, TRUE);
	addView(tvEmpty, rlp);

	rlp = new LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT);
	rlp.addRule(CENTER_HORIZONTAL, TRUE);
	rlp.addRule(ABOVE, tvEmpty.getId());
	addView(ivEmpty, rlp);

	OnClickListener ocl = new OnClickListener() {
		public void onClick(View view) {
			tvEmpty.setClickable(false);
			ivEmpty.setClickable(false);
			if (onRefreshClickListener != null) {
				onRefreshClickListener.onClick(view);
			}
		}
	};
	tvEmpty.setClickable(false);
	ivEmpty.setClickable(false);
	tvEmpty.setOnClickListener(ocl);
	ivEmpty.setOnClickListener(ocl);
}
 
開發者ID:MobClub,項目名稱:BBSSDK-for-Android,代碼行數:37,代碼來源:EmptyView.java

示例14: setUpView

import android.widget.TextView; //導入方法依賴的package包/類
@Override
protected void setUpView(View view) {
    TextView tv;
    String initialData;
    Bundle args = getArguments();
    mWalletName = args.getString( ARG_WALLET_NAME );
    mInputType  = Type.safeValueOf( args.getString( ARG_INPUT_TYPE));
    initialData = args.getString( ARG_INITIAL_INPUT_DATA );

    // title
    tv = view.findViewById( R.id.tv_title);
    tv.setText( getString(mInputType.titleStrId) + ": " + mWalletName);

    // input data
    mEtData = view.findViewById(R.id.et_input_data);

    // input data hint
    mEtData.setHint( mInputType.inputHintStrId );

    // initial data
    if ( ! StringUtils.isEmpty( initialData )) {
        UiUtils.setTextAndMoveCursorToEnd( mEtData, initialData);
    }

    // ok button
    tv = view.findViewById( R.id.btn_ok);
    tv.setText( mInputType.okButtonStrId);
    tv.setOnClickListener( v -> {
        if ( null != mCallback) mCallback.onDataEntered( mWalletName, mEtData.getText().toString());

        dismiss();
    });

    // cancel button
    view.findViewById( R.id.btn_cancel).setOnClickListener( v -> dismiss());
}
 
開發者ID:mithrilcoin-io,項目名稱:EosCommander,代碼行數:37,代碼來源:InputDataDialog.java

示例15: setActionTextViewListener

import android.widget.TextView; //導入方法依賴的package包/類
private void setActionTextViewListener(TextView view, View.OnClickListener listener) {
    view.setOnTouchListener(new TextViewChangeColourOnTouchListener(Color.BLACK,
            view.getCurrentTextColor()));
    view.setOnClickListener(listener);
}
 
開發者ID:zak0,項目名稱:AppTycoon,代碼行數:6,代碼來源:AppTycoonDialog.java


注:本文中的android.widget.TextView.setOnClickListener方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。