本文整理匯總了Java中android.widget.RelativeLayout.setOnTouchListener方法的典型用法代碼示例。如果您正苦於以下問題:Java RelativeLayout.setOnTouchListener方法的具體用法?Java RelativeLayout.setOnTouchListener怎麽用?Java RelativeLayout.setOnTouchListener使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類android.widget.RelativeLayout
的用法示例。
在下文中一共展示了RelativeLayout.setOnTouchListener方法的8個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: init
import android.widget.RelativeLayout; //導入方法依賴的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 = (RelativeLayout) 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();
}
示例2: initView
import android.widget.RelativeLayout; //導入方法依賴的package包/類
private void initView(final Context context) {
final View root = LayoutInflater.from(context).inflate(R.layout.view_status_detail, this, true);
ViewPager pager = (ViewPager) root.findViewById(R.id.photo_collection);
PhotoDetailViewPagerAdapter adapter = new PhotoDetailViewPagerAdapter(getContext(), getPhotos());
pager.setAdapter(adapter);
adapter.setItemClickListener(this);
ViewPagerIndicator indicator = (ViewPagerIndicator) findViewById(R.id.view_pager_indicator);
indicator.setGravity(3);
ImageView more_btn = (ImageView) findViewById(R.id.for_detail_btn);
RelativeLayout detail_container = (RelativeLayout) findViewById(R.id.detail_container);
detail_container.setOnTouchListener(new OnTouchListener() {
@Override
public boolean onTouch(View v, MotionEvent event) {
return true;
}
});
}
示例3: onCreate
import android.widget.RelativeLayout; //導入方法依賴的package包/類
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
tvPulsa = (TextView) findViewById(R.id.tvPulsa);
rl = (RelativeLayout) findViewById(R.id.activity_main);
animation = AnimationUtils.loadAnimation(this, R.anim.fadeinout);
tvPulsa.startAnimation(animation);
rl.setOnTouchListener(new View.OnTouchListener() {
@Override
public boolean onTouch(View v, MotionEvent event) {
Intent intent = new Intent(MainActivity.this, MenuActivity.class);
startActivity(intent);
return true;
}
});
}
示例4: initView
import android.widget.RelativeLayout; //導入方法依賴的package包/類
private void initView() {
mRelativeLayout = (RelativeLayout) findViewById(R.id.rl_main);
push_state_ll = (LinearLayout) findViewById(R.id.push_state_ll);
settings = (ImageView) findViewById(R.id.iv_settings);
settings.setOnClickListener(this);
wx_user_name = (TextView) findViewById(R.id.wx_user_name_tv);
wx_user_icon = (CircleImageView) findViewById(R.id.wx_user_icon_iv);
mCountTimeView = (CountTimeView) findViewById(R.id.count_time_view);
mRecorderButton = (ImageView) findViewById(R.id.iv_push);
mRecorderButton.setOnClickListener(this);
btn_pop_pro = (ImageView) findViewById(R.id.btn_pro);
btn_pop_pro.setOnClickListener(this);
btn_pop_talk = (ImageView) findViewById(R.id.btn_talk);
btn_pop_talk.setOnClickListener(this);
mTv_watch_person = (TextView) findViewById(R.id.tv_watch_person);
mRelativeLayout.setOnTouchListener(this);
}
示例5: handleOnClicks
import android.widget.RelativeLayout; //導入方法依賴的package包/類
private void handleOnClicks(final ViewPager emojisPager) {
for (int i = 0; i < emojiTabs.length - 1; i++) {
final RelativeLayout categoryLayout = (RelativeLayout) emojiTabs[i].findViewById(R.id.category_layout);
categoryLayout.setOnClickListener(new EmojiTabsClickListener(emojisPager, i));
}
final RelativeLayout backspaceLayout = (RelativeLayout) emojiTabs[emojiTabs.length - 1].findViewById(R.id.category_layout);
backspaceLayout.setOnTouchListener(
new RepeatListener(INITIAL_INTERVAL, NORMAL_INTERVAL, new OnClickListener() {
@Override
public void onClick(final View view) {
if (onEmojiBackspaceClickListener != null) {
onEmojiBackspaceClickListener.onEmojiBackspaceClicked(view);
}
}
}));
}
示例6: initView
import android.widget.RelativeLayout; //導入方法依賴的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);
}
示例7: initView
import android.widget.RelativeLayout; //導入方法依賴的package包/類
@Override
public void initView() {
// toolbar = (Toolbar) findViewById(R.id.tb_toolbar);
// collapsingToolbarLayout = (CollapsingToolbarLayout) findViewById(R.id.ctl_layout);
// floatingActionButton = (FloatingActionButton) findViewById(R.id.fab_avatar);
floatingActionButton = (FloatingActionButton) findViewById(R.id.fab_activity_user_detail_button);
floatingActionButton.setImageResource(R.drawable.ic_mode_edit_blue_grey_900_24dp);
// display = (RecyclerView) findViewById(R.id.rcl_content);
display = (RecyclerView) findViewById(R.id.rcv_activity_user_detail_display);
refresh = (SwipeRefreshLayout) findViewById(R.id.refresh_activity_user_detail_refresh);
// bgCover = (ImageView) findViewById(R.id.iv_background_cover);
// appBarLayout = (AppBarLayout) findViewById(R.id.al_appbar_layout);
bottomInput = (LinearLayout) findViewById(R.id.ll_user_detail_bottom);
input = (EditText) findViewById(R.id.et_user_detail_input);
send = (ImageView) findViewById(R.id.iv_user_detail_send);
rootContainer = (RelativeLayout) findViewById(R.id.rl_activity_user_detail_container);
rootContainer.getViewTreeObserver().addOnGlobalLayoutListener(new ViewTreeObserver.OnGlobalLayoutListener() {
@Override
public void onGlobalLayout() {
Rect rect = new Rect();
rootContainer.getWindowVisibleDisplayFrame(rect);
screenHeight = rootContainer.getRootView().getHeight();
int keyBoardHeight = screenHeight - rect.bottom;
int status = getStatusHeight();
if (keyBoardHeight != mKeyBoardHeight) {
if (keyBoardHeight > mKeyBoardHeight) {
bottomInput.setVisibility(View.VISIBLE);
RelativeLayout.LayoutParams layoutParams = (RelativeLayout.LayoutParams) bottomInput.getLayoutParams();
int realHeight = screenHeight - status - bottomInput.getHeight() - keyBoardHeight;
layoutParams.setMargins(0, realHeight, 0, 0);
bottomInput.setLayoutParams(layoutParams);
mKeyBoardHeight = keyBoardHeight;
floatingActionButton.setVisibility(View.GONE);
mLinearLayoutManager.scrollToPositionWithOffset(currentPosition, getListOffset());
} else {
floatingActionButton.setVisibility(View.VISIBLE);
mKeyBoardHeight = keyBoardHeight;
bottomInput.setVisibility(View.GONE);
}
}
}
});
// appBarLayout.addOnOffsetChangedListener(this);
send.setOnClickListener(this);
refresh.setOnRefreshListener(this);
floatingActionButton.setOnClickListener(this);
rootContainer.setOnTouchListener(new View.OnTouchListener() {
@Override
public boolean onTouch(View v, MotionEvent event) {
if (mCommentPopupWindow != null && mCommentPopupWindow.isShowing()) {
mCommentPopupWindow.dismiss();
}
// 這裏進行點擊關閉編輯框
if (bottomInput.getVisibility() == View.VISIBLE) {
LogUtil.e("觸摸界麵點擊關閉輸入法");
dealBottomView(false);
return true;
}
return false;
}
});
}
示例8: initUI
import android.widget.RelativeLayout; //導入方法依賴的package包/類
public void initUI() {
db = new DatabaseHelper(this);
rlHome = (RelativeLayout) findViewById(R.id.layout_home);
rlHome.setOnClickListener(this);
menu = findViewById(R.id.my_fragment);
centralView = findViewById(R.id.center_view);
menu.setVisibility(View.GONE);
//search
searchText = (EditText) findViewById(R.id.search_bar_text);
flSearch = (FrameLayout) findViewById(R.id.frame_search);
rvSearch = (RecyclerView) findViewById(R.id.rl_search);
btnCancelSearch = (ImageButton) findViewById(R.id.btn_cancel_search);
btnCancelSearch.setOnClickListener(this);
btnDecSearch = (ImageButton) findViewById(R.id.btn_dec_search);
btnSearch = (ImageButton) findViewById(R.id.btn_search);
btnSearch.setOnClickListener(this);
searchBar = (LinearLayout) findViewById(R.id.search_bar_home);
rvRight = (RecyclerView) findViewById(R.id.list_view_right);
rvLeft = (RecyclerView) findViewById(R.id.list_view_left);
frameRight = (FrameLayout) findViewById(R.id.frame_right);
frameLeft = (FrameLayout) findViewById(R.id.frame_left);
btnTheme = (ImageButton) findViewById(R.id.btn_theme);
btnTheme.setOnClickListener(this);
btnSettings = (ImageButton) findViewById(R.id.btn_settings);
btnSettings.setOnClickListener(this);
btnAddLeft = (ImageButton) findViewById(R.id.btn_add_left);
btnAddLeft.setOnClickListener(this);
btnAddRight = (ImageButton) findViewById(R.id.btn_add_right);
btnAddRight.setOnClickListener(this);
btnLeftElem = (ImageButton) findViewById(R.id.left);
btnLeftElem.setOnClickListener(this);
btnRightElem = (ImageButton) findViewById(R.id.right);
btnRightElem.setOnClickListener(this);
LinearLayoutManager managerRight =
new LinearLayoutManager(this, LinearLayoutManager.VERTICAL, false);
LinearLayoutManager managerLeft =
new LinearLayoutManager(this, LinearLayoutManager.VERTICAL, false);
managerSearch =
new LinearLayoutManager(this, LinearLayoutManager.VERTICAL, false);
rvRight.setLayoutManager(managerRight);
rvLeft.setLayoutManager(managerLeft);
rvSearch.setLayoutManager(managerSearch);
settingsHelper = new SettingsHelper(this);
settingsHelperSearch = new SettingsHelper(this);
//handling swipe action
new RecyclerItemSwiper(0, LEFT | RIGHT, this,
adapterLeft, arrayListLeft, db, "left", rvLeft);
new RecyclerItemSwiper(0, LEFT | RIGHT, this,
adapterRight, arrayListRight, db, "right", rvRight);
setupSharedPreferences();
// setupSharedPreferencesNew();
// rlHome.setOnTouchListener(new RelativeLayoutTouchListener(this));
mainElemsTouchListener = new MainElemsTouchListener(this, centralMenu, menu, rlHome);
rlHome.setOnTouchListener(mainElemsTouchListener);
}