本文整理汇总了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));
}
});
}
示例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);
}
示例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;
}
}
示例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);
}