当前位置: 首页>>代码示例>>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;未经允许,请勿转载。