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


Java ViewGroup.setOnClickListener方法代码示例

本文整理汇总了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;
}
 
开发者ID:Wilshion,项目名称:HeadlineNews,代码行数:26,代码来源:JCVideoPlayer.java

示例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();
}
 
开发者ID:Longalei,项目名称:Edu,代码行数:24,代码来源:JCVideoPlayer.java

示例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);
}
 
开发者ID:googlesamples,项目名称:android-AutofillFramework,代码行数:10,代码来源:SettingsActivity.java

示例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;
}
 
开发者ID:matejdro,项目名称:WearVibrationCenter,代码行数:19,代码来源:AppPickerFragment.java

示例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));

   }
 
开发者ID:MSay2,项目名称:Mire,代码行数:23,代码来源:MainActivity.java

示例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);
    }
}
 
开发者ID:ibosong,项目名称:CommentGallery,代码行数:36,代码来源:CommentImageGrid.java

示例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);
        }
    }
}
 
开发者ID:ibosong,项目名称:CommentGallery,代码行数:27,代码来源:CommentImageGrid.java

示例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();
}
 
开发者ID:snowwolf10285,项目名称:PicShow-zhaipin,代码行数:24,代码来源:JCVideoPlayer.java

示例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();
}
 
开发者ID:qq1210514049,项目名称:ListVideoPlayer,代码行数:26,代码来源:ListVideoPlayer.java

示例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, "点击任意空白加载界面");
    }
}
 
开发者ID:halohoop,项目名称:AndroidDigIn,代码行数:21,代码来源:MainActivity.java

示例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);
}
 
开发者ID:BrandonVargas,项目名称:AndroidOCRFforID,代码行数:23,代码来源:UCropActivity.java

示例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);
}
 
开发者ID:CankingApp,项目名称:MiniPay,代码行数:10,代码来源:ZhiActivity.java

示例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);
}
 
开发者ID:newDeepLearing,项目名称:decoy,代码行数:37,代码来源:MenuDialog.java

示例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);
}
 
开发者ID:NicoLiutong,项目名称:miaosou,代码行数:9,代码来源:ZhiActivity.java

示例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);
}
 
开发者ID:AndroidKiven,项目名称:RecyclerviewExpand,代码行数:8,代码来源:MainActivity.java


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