本文整理汇总了Java中android.view.ViewGroup.setOnClickListener方法的典型用法代码示例。如果您正苦于以下问题:Java ViewGroup.setOnClickListener方法的具体用法?Java ViewGroup.setOnClickListener怎么用?Java ViewGroup.setOnClickListener使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类android.view.ViewGroup
的用法示例。
在下文中一共展示了ViewGroup.setOnClickListener方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: init
import android.view.ViewGroup; //导入方法依赖的package包/类
public void init(Context context) {
View.inflate(context, getLayoutId(), this);
startButton = (ImageView) findViewById(R.id.start);
fullscreenButton = (ImageView) findViewById(R.id.fullscreen);
progressBar = (SeekBar) findViewById(R.id.bottom_seek_progress);
currentTimeTextView = (TextView) findViewById(R.id.current);
totalTimeTextView = (TextView) findViewById(R.id.total);
bottomContainer = (ViewGroup) findViewById(R.id.layout_bottom);
textureViewContainer = (ViewGroup) findViewById(R.id.surface_container);
topContainer = (ViewGroup) findViewById(R.id.layout_top);
startButton.setOnClickListener(this);
fullscreenButton.setOnClickListener(this);
progressBar.setOnSeekBarChangeListener(this);
bottomContainer.setOnClickListener(this);
textureViewContainer.setOnClickListener(this);
textureViewContainer.setOnTouchListener(this);
mScreenWidth = getContext().getResources().getDisplayMetrics().widthPixels;
mScreenHeight = getContext().getResources().getDisplayMetrics().heightPixels;
mAudioManager = (AudioManager) getContext().getSystemService(Context.AUDIO_SERVICE);
mHandler = new Handler();
NORMAL_ORIENTATION = context.getResources().getConfiguration().orientation;
}
示例2: init
import android.view.ViewGroup; //导入方法依赖的package包/类
public void init(Context context) {
View.inflate(context, getLayoutId(), this);
startButton = (ImageView) findViewById(R.id.start);
fullscreenButton = (ImageView) findViewById(R.id.fullscreen);
progressBar = (SeekBar) findViewById(R.id.bottom_seek_progress);
currentTimeTextView = (TextView) findViewById(R.id.current);
totalTimeTextView = (TextView) findViewById(R.id.total);
bottomContainer = (ViewGroup) findViewById(R.id.layout_bottom);
textureViewContainer = (ViewGroup) findViewById(R.id.surface_container);
topContainer = (ViewGroup) findViewById(R.id.layout_top);
startButton.setOnClickListener(this);
fullscreenButton.setOnClickListener(this);
progressBar.setOnSeekBarChangeListener(this);
bottomContainer.setOnClickListener(this);
textureViewContainer.setOnClickListener(this);
textureViewContainer.setOnTouchListener(this);
mScreenWidth = getContext().getResources().getDisplayMetrics().widthPixels;
mScreenHeight = getContext().getResources().getDisplayMetrics().heightPixels;
mAudioManager = (AudioManager) getContext().getSystemService(Context.AUDIO_SERVICE);
mHandler = new Handler();
}
示例3: setupSettingsButton
import android.view.ViewGroup; //导入方法依赖的package包/类
private void setupSettingsButton(int containerId, int labelId, int imageViewId,
final View.OnClickListener onClickListener) {
ViewGroup container = findViewById(containerId);
TextView buttonLabel = container.findViewById(labelId);
String buttonLabelText = buttonLabel.getText().toString();
ImageView imageView = container.findViewById(imageViewId);
imageView.setContentDescription(buttonLabelText);
container.setOnClickListener(onClickListener);
}
示例4: onCreateViewHolder
import android.view.ViewGroup; //导入方法依赖的package包/类
@Override
public ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
ViewGroup view = (ViewGroup) LayoutInflater.from(getActivity()).inflate(R.layout.fragment_app_list_item, parent, false);
final ViewHolder holder = new ViewHolder(view);
holder.icon = (ImageView) view.findViewById(R.id.appImage);
holder.name = (TextView) view.findViewById(R.id.appName);
view.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
AppInfoStorage pickedApp = apps.get(holder.getAdapterPosition());
((AppPickerCallback) getActivity()).onAppPicked(pickedApp.packageName, pickedApp.label.toString());
}
});
return holder;
}
示例5: addMenuItem
import android.view.ViewGroup; //导入方法依赖的package包/类
private void addMenuItem(ViewGroup menu, String text, int drawableResource, int splashColor, int menu_btn, int menuIndex)
{
ViewGroup item = (ViewGroup)LayoutInflater.from(this).inflate(R.layout.menu_item, menu, false);
((TextView)item.findViewById(R.id.item_text)).setText(text);
CircularSplashView ic = (CircularSplashView)item.findViewById(R.id.circle);
ic.setSplash(BitmapFactory.decodeResource(getResources(), drawableResource));
ic.setSplashColor(splashColor);
item.setOnClickListener(getMenuItemCLick(menuIndex, splashColor));
if (menuIndex == 0)
{
menu.addView(item, new LinearLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT));
}
else if (menuIndex == 3)
{
menu.addView(item, new LinearLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT));
}
else
menu.addView(item, new LinearLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT));
item.setBackground(getResources().getDrawable(menu_btn, null));
}
示例6: layoutChildrenView
import android.view.ViewGroup; //导入方法依赖的package包/类
private void layoutChildrenView() {
int childrenCount = getChildCount();
for (int i = 0; i < childrenCount; i++) {
ViewGroup childImageLayout = (ViewGroup) getChildAt(i);
SimpleDraweeView childImageView = (SimpleDraweeView) childImageLayout.getChildAt(0);
if (mOnItemClickListener != null) {
final int finalI = i;
childImageLayout.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
mOnItemClickListener.OnItemClick(finalI);
}
});
}
ImageRequest request = ImageRequestBuilder.newBuilderWithSource(Uri.parse(mImageUrls.get(i)))
.setProgressiveRenderingEnabled(true)
.setResizeOptions(new ResizeOptions(mItemWidth, mItemWidth))
.build();
DraweeController controller = Fresco.newDraweeControllerBuilder()
.setImageRequest(request)
.setOldController(childImageView.getController())
.build();
childImageView.setController(controller);
int[] position = findPosition(i);
int itemHeight = mItemWidth;
int left = (int) (mItemWidth + mHorizontalSpace) * position[1];
int top = (int) (itemHeight + mVerticalSpace) * position[0];
int right = left + mItemWidth;
int bottom = top + itemHeight;
childImageLayout.layout(left, top, right, bottom);
}
}
示例7: refreshImageChild
import android.view.ViewGroup; //导入方法依赖的package包/类
private void refreshImageChild() {
int childrenCount = getChildCount();
if (childrenCount > 0) {
for (int i = 0; i < childrenCount; i++) {
ViewGroup childImageLayout = (ViewGroup) getChildAt(i);
SimpleDraweeView childImageView = (SimpleDraweeView) childImageLayout.getChildAt(0);
if (mOnItemClickListener != null) {
final int finalI = i;
childImageLayout.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
mOnItemClickListener.OnItemClick(finalI);
}
});
}
ImageRequest request = ImageRequestBuilder.newBuilderWithSource(Uri.parse(mImageUrls.get(i)))
.setResizeOptions(new ResizeOptions(mItemWidth, mItemWidth))
.build();
DraweeController controller = Fresco.newDraweeControllerBuilder()
.setImageRequest(request)
.setOldController(childImageView.getController())
.build();
childImageView.setController(controller);
}
}
}
示例8: init
import android.view.ViewGroup; //导入方法依赖的package包/类
public void init(Context context) {
View.inflate(context, getLayoutId(), this);
startButton = (ImageView) findViewById(R.id.start);
fullscreenButton = (ImageView) findViewById(R.id.fullscreen);
progressBar = (SeekBar) findViewById(R.id.progress);
currentTimeTextView = (TextView) findViewById(R.id.current);
totalTimeTextView = (TextView) findViewById(R.id.total);
bottomContainer = (ViewGroup) findViewById(R.id.layout_bottom);
textureViewContainer = (ViewGroup) findViewById(R.id.surface_container);
topContainer = (ViewGroup) findViewById(R.id.layout_top);
startButton.setOnClickListener(this);
fullscreenButton.setOnClickListener(this);
progressBar.setOnSeekBarChangeListener(this);
bottomContainer.setOnClickListener(this);
textureViewContainer.setOnClickListener(this);
textureViewContainer.setOnTouchListener(this);
mScreenWidth = getContext().getResources().getDisplayMetrics().widthPixels;
mScreenHeight = getContext().getResources().getDisplayMetrics().heightPixels;
mAudioManager = (AudioManager) getContext().getSystemService(Context.AUDIO_SERVICE);
mHandler = new Handler();
}
示例9: init
import android.view.ViewGroup; //导入方法依赖的package包/类
public void init(Context context) {
View.inflate(context, getLayoutId(), this);
startButton = (ImageView) findViewById(R.id.start);
fullscreenButton = (ImageView) findViewById(R.id.fullscreen);
progressBar = (SeekBar) findViewById(R.id.progress);
currentTimeTextView = (TextView) findViewById(R.id.current);
totalTimeTextView = (TextView) findViewById(R.id.total);
bottomContainer = (ViewGroup) findViewById(R.id.layout_bottom);
textureViewContainer = (ViewGroup) findViewById(R.id.surface_container);
topContainer = (ViewGroup) findViewById(R.id.layout_top);
titleTextView = (TextView) findViewById(R.id.title);
backButton = (ImageView) findViewById(R.id.back);
backButton.setVisibility(View.GONE);
backButton.setOnClickListener(this);
startButton.setOnClickListener(this);
fullscreenButton.setOnClickListener(this);
progressBar.setOnSeekBarChangeListener(this);
bottomContainer.setOnClickListener(this);
textureViewContainer.setOnClickListener(this);
textureViewContainer.setOnTouchListener(this);
mHandler = new Handler();
}
示例10: onCreate
import android.view.ViewGroup; //导入方法依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
mViewGroup = (ViewGroup) findViewById(R.id.frag_container);
if (!mIsBeenThroughOnSaveInstanceState) {
mViewGroup.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
listDataFragment = ListDataFragment.newInstance(-1);
getSupportFragmentManager().beginTransaction()
.add(R.id.frag_container, listDataFragment, "")
.commit();
mIsBeenThroughOnSaveInstanceState = true;
mViewGroup.setOnClickListener(null);
}
});
Utils.showToast(this, "点击任意空白加载界面");
}
}
示例11: initiateRootViews
import android.view.ViewGroup; //导入方法依赖的package包/类
private void initiateRootViews() {
mUCropView = (UCropView) findViewById(R.id.ucrop);
mGestureCropImageView = mUCropView.getCropImageView();
mOverlayView = mUCropView.getOverlayView();
mGestureCropImageView.setTransformImageListener(mImageListener);
if (mShowBottomControls) {
mWrapperStateAspectRatio = (ViewGroup) findViewById(R.id.state_aspect_ratio);
mWrapperStateAspectRatio.setOnClickListener(mStateClickListener);
mWrapperStateRotate = (ViewGroup) findViewById(R.id.state_rotate);
mWrapperStateRotate.setOnClickListener(mStateClickListener);
mWrapperStateScale = (ViewGroup) findViewById(R.id.state_scale);
mWrapperStateScale.setOnClickListener(mStateClickListener);
mLayoutAspectRatio = (ViewGroup) findViewById(R.id.layout_aspect_ratio);
mLayoutRotate = (ViewGroup) findViewById(R.id.layout_rotate_wheel);
mLayoutScale = (ViewGroup) findViewById(R.id.layout_scale_wheel);
}
((ImageView) findViewById(R.id.image_view_logo)).setColorFilter(mLogoColor, PorterDuff.Mode.SRC_ATOP);
}
示例12: initView
import android.view.ViewGroup; //导入方法依赖的package包/类
private void initView() {
mTitleTv = (TextView) findViewById(R.id.zhi_title);
mSummeryTv = (TextView) findViewById(R.id.zhi_summery);
mQaView = (ViewGroup) findViewById(R.id.qa_layout);
mZhiBg = (ViewGroup) findViewById(R.id.zhi_bg);
mQaImage = (ImageView) findViewById(R.id.qa_image_view);
mTip = (TextView) findViewById(R.id.tip);
mZhiBg.setOnClickListener(this);
}
示例13: onCreate
import android.view.ViewGroup; //导入方法依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
getWindow().setLayout(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT);
rootView = (ViewGroup) View.inflate(context, R.layout.nim_menu_dialog, null);
itemsRootView = (LinearLayout) rootView.findViewById(R.id.menu_dialog_items_root);
if (selectMode) {
itemViews = new ArrayList<>();
}
View itemView;
for (int i = 0; i < btnNames.size(); i++) {
itemView = View.inflate(context, R.layout.nim_menu_dialog_item, null);
((TextView) itemView.findViewById(R.id.menu_button)).setText(btnNames.get(i));
itemView.setTag(i);
itemView.setOnClickListener(this);
if (selectMode) {
itemViews.add(itemView);
}
itemsRootView.addView(itemView);
}
selectItem();
rootView.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
dismiss();
}
});
setContentView(rootView);
}
示例14: initView
import android.view.ViewGroup; //导入方法依赖的package包/类
private void initView() {
mTitleTv = (TextView) findViewById(R.id.zhi_title);
mSummeryTv = (TextView) findViewById(R.id.zhi_summery);
mQaView = (ViewGroup) findViewById(R.id.qa_layout);
mZhiBg = (ViewGroup) findViewById(R.id.zhi_bg);
mQaImage = (ImageView) findViewById(R.id.qa_image_view);
mZhiBg.setOnClickListener(this);
}
示例15: MainViewHolder
import android.view.ViewGroup; //导入方法依赖的package包/类
public MainViewHolder(ViewGroup itemView) {
super(itemView);
contactNameTV = ((TextView) itemView.findViewById(R.id.contactName));
infos = ((TextView) itemView.findViewById(R.id.infos));
itemView.setOnClickListener(this);
}