當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。