當前位置: 首頁>>代碼示例>>Java>>正文


Java LinearLayout.setOnTouchListener方法代碼示例

本文整理匯總了Java中android.widget.LinearLayout.setOnTouchListener方法的典型用法代碼示例。如果您正苦於以下問題:Java LinearLayout.setOnTouchListener方法的具體用法?Java LinearLayout.setOnTouchListener怎麽用?Java LinearLayout.setOnTouchListener使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在android.widget.LinearLayout的用法示例。


在下文中一共展示了LinearLayout.setOnTouchListener方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: setupSongPanel

import android.widget.LinearLayout; //導入方法依賴的package包/類
private void setupSongPanel(View root) {
    //Set up song panel (gestures)
    LinearLayout songPanel = (LinearLayout) root.findViewById(R.id.song_player_song_panel);
    songPanel.setOnTouchListener(new OnSwipeTouchListener(getActivity()) {
        public void onSwipeTop() {
            Toast.makeText(getActivity(),"Increase Volume",Toast.LENGTH_SHORT).show();
            mPresenter.volumeUp();
        }
        public void onSwipeRight() {
            mPresenter.lastSong();
            Logger.get().log(new UserEvent(UserEvent.Source.Gesture, UserEvent.Action.Next));
        }
        public void onSwipeLeft() {
            mPresenter.nextSong();
            Logger.get().log(new UserEvent(UserEvent.Source.Gesture, UserEvent.Action.Last));
        }
        public void onSwipeBottom() {
            Toast.makeText(getActivity(), "Decrease Volume", Toast.LENGTH_SHORT).show();
            mPresenter.volumeDown();
        }
        public void onSingleTap() {
            mPresenter.playPauseSong();
            Logger.get().log(new UserEvent(UserEvent.Source.Gesture, UserEvent.Action.PlayPause));
        }
    });
}
 
開發者ID:Captwalloper,項目名稱:NUI_Project,代碼行數:27,代碼來源:SongPlayerFragment.java

示例2: initView

import android.widget.LinearLayout; //導入方法依賴的package包/類
private void initView() {
    showBigBang = SPHelper.getBoolean(ConstantUtil.TOTAL_SWITCH, true);
    isStick=SPHelper.getBoolean(ConstantUtil.FLOATVIEW_IS_STICK,false);

    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB_MR2) {
        Point point = new Point();
        mWindowManager.getDefaultDisplay().getSize(point);
        mScreenWidth = point.x;
        mScreenHeight = point.y;
    } else {
        mScreenWidth = mWindowManager.getDefaultDisplay().getWidth();
        mScreenHeight = mWindowManager.getDefaultDisplay().getHeight();
    }
    if (showBigBang) {
        mCurrentIconAlpha =  SPHelper.getInt(ConstantUtil.FLOATVIEW_ALPHA, 70) / 100f;
    } else {
        mCurrentIconAlpha = 0.6f * SPHelper.getInt(ConstantUtil.FLOATVIEW_ALPHA, 70) / 100f;
    }

    iconFloatView = (LinearLayout) View.inflate(mContext, R.layout.arc_float_icon, null);
    floatImageView = ((ImageView) iconFloatView.findViewById(R.id.float_image));
    acrFloatView = (RelativeLayout) View.inflate(mContext, R.layout.arc_view_float, null);
    archMenu = (ArcMenu) acrFloatView.findViewById(R.id.arc_menu);
    initIcon();
    archMenu.setOnModeSeletedListener(new ArcMenu.OnModeSeletedListener() {
        @Override
        public void onModeSelected() {
            showFloatImageView();
        }

        @Override
        public void onNothing() {

        }
    });
    // event listeners
    acrFloatView.setOnTouchListener(this);
    iconFloatView.setOnTouchListener(this);
}
 
開發者ID:l465659833,項目名稱:Bigbang,代碼行數:40,代碼來源:ArcTipViewController.java

示例3: addMoreDays

import android.widget.LinearLayout; //導入方法依賴的package包/類
private void addMoreDays() {
    int currentDataSize = dateData.size();
    for (int i = 0; i < NEW_COUNT; i++) {
        DateScrollerData data = DateScrollerUitls.addDate(getContext(), calendar, 1);
        dateData.add(data);
        LinearLayout child = (LinearLayout) LayoutInflater
                .from(getContext()).inflate(R.layout.item_datescroller, null);
        ((TextView) child.findViewById(R.id.item_datescroller_dayOfWeek)).setText(data.getDay());
        ((TextView) child.findViewById(R.id.item_datescroller_day))
                .setText(data.getDayOfMonth() + "");
        final int postion = currentDataSize + i;

        child.setOnTouchListener(new OnTouchListener() {
            @Override
            public boolean onTouch(View v, MotionEvent event) {

                if (!isScrolling)
                    setSelected(postion);
                return false;
            }


        });

        addView(child);
        isAddingDays = false;
    }
}
 
開發者ID:arjinmc,項目名稱:DateScroller,代碼行數:29,代碼來源:DateScrollerView.java

示例4: init

import android.widget.LinearLayout; //導入方法依賴的package包/類
private void init(Context context) {
	SizeHelper.prepare(context);

	lvContries = new GroupListView(context);
	lvContries.setDividerHeight(SizeHelper.fromPxWidth(1));
	int resId = ResHelper.getBitmapRes(context, "smssdk_cl_divider");
	if (resId > 0) {
		lvContries.setDivider(context.getResources().getDrawable(resId));
	}
	adapter = new CountryAdapter(lvContries);
	lvContries.setAdapter(adapter);
	LayoutParams lpContries = new LayoutParams(
			LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT);
	int dp9 = SizeHelper.fromPxWidth(12);
	lpContries.setMargins(dp9, 0, dp9, 0);
	addView(lvContries, lpContries);

	tvScroll = new TextView(context);
	resId = ResHelper.getColorRes(context, "smssdk_white");
	if (resId > 0) {
		tvScroll.setTextColor(context.getResources().getColor(resId));
	}
	resId = ResHelper.getBitmapRes(context, "smssdk_country_group_scroll_down");
	if (resId > 0) {
		tvScroll.setBackgroundResource(resId);
	}
	tvScroll.setTextSize(TypedValue.COMPLEX_UNIT_PX, SizeHelper.fromPxWidth(80));
	tvScroll.setTypeface(Typeface.DEFAULT);
	tvScroll.setVisibility(GONE);
	tvScroll.setGravity(Gravity.CENTER);
	int dp80 = SizeHelper.fromPxWidth(120);
	LayoutParams lp = new LayoutParams(dp80, dp80);
	lp.addRule(CENTER_IN_PARENT);
	addView(tvScroll, lp);

	llScroll = new LinearLayout(context);
	resId = ResHelper.getBitmapRes(context, "smssdk_country_group_scroll_up");
	if (resId > 0) {
		llScroll.setBackgroundResource(resId);
	}
	llScroll.setOrientation(LinearLayout.VERTICAL);
	llScroll.setOnTouchListener(this);
	lp = new LayoutParams(
			LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT);
	lp.addRule(ALIGN_PARENT_RIGHT);
	lp.addRule(CENTER_VERTICAL);
	lp.rightMargin = SizeHelper.fromPxWidth(7);
	addView(llScroll, lp);

	initScroll(context);
}
 
開發者ID:weiwenqiang,項目名稱:GitHub,代碼行數:52,代碼來源:CountryListView.java


注:本文中的android.widget.LinearLayout.setOnTouchListener方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。