本文整理汇总了Java中android.widget.LinearLayout.setOnClickListener方法的典型用法代码示例。如果您正苦于以下问题:Java LinearLayout.setOnClickListener方法的具体用法?Java LinearLayout.setOnClickListener怎么用?Java LinearLayout.setOnClickListener使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类android.widget.LinearLayout
的用法示例。
在下文中一共展示了LinearLayout.setOnClickListener方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: ViewHolder
import android.widget.LinearLayout; //导入方法依赖的package包/类
public ViewHolder(View itemView, int flag) {
super(itemView);
upCheckbox = (CheckBox) itemView.findViewById(R.id.item_rant_item_checkbox_up);
downCheckbox = (CheckBox) itemView.findViewById(R.id.item_rant_item_checkbox_down);
valueTextView = (TextView) itemView.findViewById(R.id.item_rant_item_tv_value);
contentTextView = (TextView)itemView.findViewById(R.id.item_rant_item_tv_content);
nameTextView = (TextView)itemView.findViewById(R.id.item_rant_item_tv_name);
commentNumTextView = (TextView)itemView.findViewById(R.id.item_rant_item_tv_comment_num);
dateTextView = (TextView)itemView.findViewById(R.id.item_rant_item_tv_date);
linearLayout = (LinearLayout) itemView.findViewById(R.id.item_rant_item_ll_clickable);
actionTextView = (TextView) itemView.findViewById(R.id.item_rant_item_tv_action);
actionTextView.setText(flag==1?"删除":"取消");
linearLayout.setOnClickListener(this);
}
示例2: addCrumb
import android.widget.LinearLayout; //导入方法依赖的package包/类
public void addCrumb(@NonNull Crumb crumb, boolean refreshLayout) {
LinearLayout view = (LinearLayout) LayoutInflater.from(getContext()).inflate(R.layout.bread_crumb, this, false);
view.setTag(mCrumbs.size());
view.setOnClickListener(this);
ImageView iv = (ImageView) view.getChildAt(1);
if (Build.VERSION.SDK_INT >= 19 && iv.getDrawable() != null) {
iv.getDrawable().setAutoMirrored(true);
}
iv.setVisibility(View.GONE);
mChildFrame.addView(view, new ViewGroup.LayoutParams(
ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT));
mCrumbs.add(crumb);
if (refreshLayout) {
mActive = mCrumbs.size() - 1;
requestLayout();
}
invalidateActivatedAll();
}
示例3: getView
import android.widget.LinearLayout; //导入方法依赖的package包/类
public View getView(LayoutInflater inflater, Setting setting, View convertView, Context context) {
if (mView != null) return mView;
mView = convertView = inflater.inflate(R.layout.row_setting_link, null);
// re-initialize views
mTitle = (TextView) convertView.findViewById(R.id.title_view);
mDescr = (TextView) convertView.findViewById(R.id.descr_view);
mIcon = (ImageView) convertView.findViewById(R.id.icon_view);
LinearLayout clicableLeft = (LinearLayout) convertView.findViewById(R.id.clickable_left);
// set values
mSetting = setting;
// set listeners
clicableLeft.setOnClickListener(this);
clicableLeft.setOnLongClickListener(setting.prefs == null ? null : this);
// update view
updateView();
return convertView;
}
示例4: initWidgets
import android.widget.LinearLayout; //导入方法依赖的package包/类
@Override
protected void initWidgets() {
super.initWidgets();
mReminderLayout = (LinearLayout) findViewById(R.id.kf5_serch_reminder_layout);
mReminderLayout.setOnClickListener(this);
mSearchLayout = (RelativeLayout) findViewById(R.id.kf5_search_layout_content);
mEditText = (EditText) findViewById(R.id.kf5_search_content_edittext);
mEditText.setOnKeyListener(this);
mImageDelete = (ImageView) findViewById(R.id.kf5_img_delete_content);
mImageDelete.setOnClickListener(this);
mListView = (RefreshListView) findViewById(R.id.kf5_help_center_listview);
mListView.setOnScrollState(this);
mListView.setOnScrollChange(this);
mListView.addFooterView();
mListView.setOnRefreshListener(this);
mListView.setOnItemClickListener(this);
mHelpCenterAdapter = new HelpCenterAdapter(mActivity, listItem);
mListView.setAdapter(mHelpCenterAdapter);
mTitleView = (TextView) findViewById(R.id.kf5_title);
mTitleView.setText(R.string.kf5_article_list);
mRightView = (TextView) findViewById(R.id.kf5_right_text_view);
mRightView.setOnClickListener(this);
mTimer = new Timer();
mBackImage = (ImageView) findViewById(R.id.kf5_return_img);
mBackImage.setOnClickListener(this);
}
示例5: initWidgets
import android.widget.LinearLayout; //导入方法依赖的package包/类
@Override
protected void initWidgets() {
super.initWidgets();
mReminderLayout = (LinearLayout) findViewById(R.id.kf5_serch_reminder_layout);
mReminderLayout.setOnClickListener(this);
mSearchLayout = (RelativeLayout) findViewById(R.id.kf5_search_layout_content);
mEditText = (EditText) findViewById(R.id.kf5_search_content_edittext);
mEditText.setOnKeyListener(this);
mImageDelete = (ImageView) findViewById(R.id.kf5_img_delete_content);
mImageDelete.setOnClickListener(this);
mListView = (RefreshListView) findViewById(R.id.kf5_help_center_listview);
mListView.setOnScrollState(this);
mListView.setOnScrollChange(this);
mListView.addFooterView();
mListView.setOnRefreshListener(this);
mListView.setOnItemClickListener(this);
mHelpCenterAdapter = new HelpCenterAdapter(mActivity, listItem);
mListView.setAdapter(mHelpCenterAdapter);
mTitleView = (TextView) findViewById(R.id.kf5_title);
mTitleView.setText(R.string.kf5_article_section);
mRightView = (TextView) findViewById(R.id.kf5_right_text_view);
mRightView.setOnClickListener(this);
mTimer = new Timer();
mBackImage = (ImageView) findViewById(R.id.kf5_return_img);
mBackImage.setOnClickListener(this);
}
示例6: loadScheduleDescriptions
import android.widget.LinearLayout; //导入方法依赖的package包/类
private void loadScheduleDescriptions(FlexboxLayout descriptionContainer, int minutes) {
int index = 0;
for (ScheduleType scheduleType : schedules.get(minutes)) {
View descriptionView = inflater.inflate(R.layout.item_schedule_description, descriptionContainer, false);
// set up onclick listener
LinearLayout scheduleLayout = descriptionView.findViewById(R.id.scheduleLayout);
scheduleLayout.setOnClickListener(view -> {
loadScheduleDetails(scheduleType);
});
// update textviews
TextView monthsLabel = descriptionView.findViewById(R.id.bigLengthLabel);
TextView weeksLabel = descriptionView.findViewById(R.id.smallLengthLabel);
TextView repsLabel = descriptionView.findViewById(R.id.repsLabel);
monthsLabel.setText(scheduleType.getCourseLength());
weeksLabel.setText(scheduleType.getCourseLengthSmall());
repsLabel.setText(scheduleType.getRepsAsString());
// if it's the last one, don't show the "or"
if (++index == schedules.get(minutes).size()) {
TextView orLabel = descriptionView.findViewById(R.id.orLabel);
orLabel.setVisibility(View.GONE);
}
// add view to container
descriptionContainer.addView(descriptionView);
}
}
示例7: initView
import android.widget.LinearLayout; //导入方法依赖的package包/类
private void initView() {
LinearLayout linearLayout = (LinearLayout) findViewById(R.id.linear1);
linearLayout.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
if (!isOpen) {
CodeUtils.isLightEnable(true);
isOpen = true;
} else {
CodeUtils.isLightEnable(false);
isOpen = false;
}
}
});
}
示例8: RecommendProduct_ListView
import android.widget.LinearLayout; //导入方法依赖的package包/类
public RecommendProduct_ListView(Context context, final RecommendProduct_ListItem aItem) {
super(context);
LayoutInflater inflater = (LayoutInflater)context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
inflater.inflate(R.layout.recommend_list_view_item, this, true);
number_text = (TextView)findViewById(R.id.recommend_product_number_text);
number_text.setText(aItem.getNumber());
keyword_text = (TextView)findViewById(R.id.recommend_product_keyword_text);
keyword_text.setText(aItem.getKeyword());
listitem_layout = (LinearLayout)findViewById(R.id.recommend_layout);
listitem_layout.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
Intent intent = new Intent(getApplicationContext(), ActivityRecommendProductsSelect.class);
intent.putExtra("url", aItem.getUrl());
intent.putExtra("keyword", aItem.getKeyword() );
startActivityForResult(intent, SELECT_REQUEST);
}
});
}
示例9: initView
import android.widget.LinearLayout; //导入方法依赖的package包/类
@Override
protected void initView() {
mLinearLayout = (LinearLayout) findViewById(R.id.ll_about_mobile_video);
mLinearLayout.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
}
});
}
示例10: addItem
import android.widget.LinearLayout; //导入方法依赖的package包/类
public BottomGridSheetBuilder addItem(int imageRes, CharSequence text, Object tag, @Style int style, int subscriptRes) {
LayoutInflater inflater = LayoutInflater.from(mContext);
// 给机会让用的人自定义ItemView
LinearLayout itemView = (LinearLayout) inflater.inflate(R.layout.qmui_bottom_sheet_grid_item, null, false);
// 字体加粗
TextView titleTV = (TextView) itemView.findViewById(R.id.grid_item_title);
if(mItemTextTypeFace != null){
titleTV.setTypeface(mItemTextTypeFace);
}
titleTV.setText(text);
itemView.setTag(tag);
itemView.setOnClickListener(this);
AppCompatImageView imageView = (AppCompatImageView) itemView.findViewById(R.id.grid_item_image);
imageView.setImageResource(imageRes);
if (subscriptRes != 0) {
ViewStub stub = (ViewStub) itemView.findViewById(R.id.grid_item_subscript);
View inflated = stub.inflate();
((ImageView) inflated).setImageResource(subscriptRes);
}
switch (style) {
case FIRST_LINE:
mFirstLineViews.append(mFirstLineViews.size(), itemView);
break;
case SECOND_LINE:
mSecondLineViews.append(mSecondLineViews.size(), itemView);
break;
}
return this;
}
示例11: onCreate
import android.widget.LinearLayout; //导入方法依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
//::::: Action Bar
toolbar = (Toolbar) findViewById(R.id.toolbar);
setSupportActionBar(toolbar);
//::::::: Action Split profile
navigation_split_profile = (LinearLayout) findViewById(R.id.navigation_split_profile );
navigation_split_profile.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
nextLayout = new Intent(MainActivity.this, ProfileActivity.class);
startActivity(nextLayout);
finish();
}
});
drawer = (DrawerLayout) findViewById(R.id.drawer_layout);
toggle = new ActionBarDrawerToggle(this, drawer, toolbar, R.string.navigation_drawer_open,
R.string.navigation_drawer_close);
drawer.addDrawerListener(toggle); //to add a listener and
// Split Menu - (open split)
MenuSplit();
//:::FRAGMENT
if (savedInstanceState == null)
positionSplit = 0;
selectFragment(positionSplit);
}
示例12: initViews
import android.widget.LinearLayout; //导入方法依赖的package包/类
private void initViews() {
messageTop = (SwitchButton) findViewById(R.id.sw_group_top);
messageNotification = (SwitchButton) findViewById(R.id.sw_group_notfaction);
messageTop.setOnCheckedChangeListener(this);
messageNotification.setOnCheckedChangeListener(this);
LinearLayout groupClean = (LinearLayout) findViewById(R.id.group_clean);
mGridView = (DemoGridView) findViewById(R.id.gridview);
mTextViewMemberSize = (TextView) findViewById(R.id.group_member_size);
mGroupHeader = (SelectableRoundedImageView) findViewById(R.id.group_header);
LinearLayout mGroupDisplayName = (LinearLayout) findViewById(R.id.group_displayname);
mGroupDisplayNameText = (TextView) findViewById(R.id.group_displayname_text);
mGroupName = (TextView) findViewById(R.id.group_name);
mQuitBtn = (Button) findViewById(R.id.group_quit);
mDismissBtn = (Button) findViewById(R.id.group_dismiss);
RelativeLayout totalGroupMember = (RelativeLayout) findViewById(R.id.group_member_size_item);
LinearLayout mGroupPortL = (LinearLayout) findViewById(R.id.ll_group_port);
LinearLayout mGroupNameL = (LinearLayout) findViewById(R.id.ll_group_name);
mGroupAnnouncementDividerLinearLayout = (LinearLayout) findViewById(R.id.ac_ll_group_announcement_divider);
mGroupNotice = (LinearLayout) findViewById(R.id.group_announcement);
mSearchMessagesLinearLayout = (LinearLayout) findViewById(R.id.ac_ll_search_chatting_records);
mGroupPortL.setOnClickListener(this);
mGroupNameL.setOnClickListener(this);
totalGroupMember.setOnClickListener(this);
mGroupDisplayName.setOnClickListener(this);
mQuitBtn.setOnClickListener(this);
mDismissBtn.setOnClickListener(this);
groupClean.setOnClickListener(this);
mGroupNotice.setOnClickListener(this);
mSearchMessagesLinearLayout.setOnClickListener(this);
}
示例13: init
import android.widget.LinearLayout; //导入方法依赖的package包/类
private void init() {
linearLayoutActivity = (LinearLayout) findViewById(add_add4);
recyclerView = (RecyclerView) findViewById(add_recycler4);
btnBackButton = (Button) findViewById(add_back4);
linearLayoutGrades =(LinearLayout) findViewById(add_grade4);
linearLayoutGrades.setOnClickListener(this);
linearLayoutActivity.setOnClickListener(this);
btnBackButton.setOnClickListener(this);
}
示例14: onCreate
import android.widget.LinearLayout; //导入方法依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main_info_fragment_layout);
top_bar_linear_back=(LinearLayout)this.findViewById(R.id.top_bar_linear_back);
top_bar_linear_back.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
MainInfoActivity.this.finish();
}
});
top_bar_title=(TextView)this.findViewById(R.id.top_bar_title);
top_bar_title.setText("Fragment+ViewPager+FragmentStatePagerAdapter实例");
}
示例15: ViewHolder
import android.widget.LinearLayout; //导入方法依赖的package包/类
public ViewHolder(final View itemView) {
super(itemView);
tv_saleOrder = (AlwaysMarqueeTextView) itemView.findViewById(R.id.tv_top_left);
tv_orderCommodityName = (AlwaysMarqueeTextView) itemView.findViewById(R.id.tv_down_left);
tv_orderCommodityAmount = (AppCompatTextView) itemView.findViewById(R.id.tv_top_right);
tv_createDate = (AppCompatTextView) itemView.findViewById(R.id.tv_down_right);
ll_content = (LinearLayout) itemView.findViewById(R.id.ll_content);
ll_content.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
}
});
}