本文整理汇总了Java中android.view.View.performClick方法的典型用法代码示例。如果您正苦于以下问题:Java View.performClick方法的具体用法?Java View.performClick怎么用?Java View.performClick使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类android.view.View
的用法示例。
在下文中一共展示了View.performClick方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: clickNoConstraints
import android.view.View; //导入方法依赖的package包/类
static ViewAction clickNoConstraints() {
return new ViewAction() {
@Override
public Matcher<View> getConstraints() {
return isEnabled(); // No constraints, isEnabled and isClickable are checked
}
@Override
public String getDescription() {
return "Click a view with no constraints.";
}
@Override
public void perform(UiController uiController, View view) {
view.performClick();
}
};
}
示例2: clickChildViewWithId
import android.view.View; //导入方法依赖的package包/类
public static ViewAction clickChildViewWithId(final int id) {
return new ViewAction() {
@Override
public Matcher<View> getConstraints() {
return null;
}
@Override
public String getDescription() {
return "Click on a child view with specified id.";
}
@Override
public void perform(UiController uiController, View view) {
View v = view.findViewById(id);
v.performClick();
}
};
}
示例3: onTouch
import android.view.View; //导入方法依赖的package包/类
@Override
public boolean onTouch(View view, MotionEvent motionEvent) {
switch (motionEvent.getAction()) {
case MotionEvent.ACTION_DOWN:
ObjectAnimator animator = ObjectAnimator.ofFloat(view, "translationZ", 20);
animator.setDuration(200);
animator.setInterpolator(new DecelerateInterpolator());
animator.start();
view.performClick();
return true;
case MotionEvent.ACTION_CANCEL:
case MotionEvent.ACTION_UP:
ObjectAnimator animator2 = ObjectAnimator.ofFloat(view, "translationZ", 0);
animator2.setDuration(200);
animator2.setInterpolator(new AccelerateInterpolator());
animator2.start();
return true;
default:
return false;
}
}
示例4: onTouch
import android.view.View; //导入方法依赖的package包/类
@Override
public boolean onTouch(View v, MotionEvent e) {
int action = e.getAction() & 255;
switch (action){
case MotionEvent.ACTION_DOWN:
x = e.getX();
return true;
case MotionEvent.ACTION_UP:
if (e.getX()-x > 30.0 * density) {
LauncherApp.getInstance().getCategoryManager().setCurCategory(LauncherApp.getInstance().getCategoryManager().getPrevCategory());
appsRef.get().loadFilteredApps();
appsRef.get().setSpinner();
return true;
} else if (x-e.getX() > 30.0 * density) {
LauncherApp.getInstance().getCategoryManager().setCurCategory(LauncherApp.getInstance().getCategoryManager().getNextCategory());
appsRef.get().loadFilteredApps();
appsRef.get().setSpinner();
return true;
} else v.performClick();
default:
return false;
}
}
示例5: getMessageLongClickListener
import android.view.View; //导入方法依赖的package包/类
private View.OnLongClickListener getMessageLongClickListener(final Wrapper<MESSAGE> wrapper) {
return new View.OnLongClickListener() {
@Override
public boolean onLongClick(View view) {
if (selectionListener == null) {
notifyMessageLongClicked(wrapper.item);
notifyMessageViewLongClicked(view, wrapper.item);
return true;
} else {
isSelectionModeEnabled = true;
view.performClick();
return true;
}
}
};
}
示例6: onTouch
import android.view.View; //导入方法依赖的package包/类
@Override
public boolean onTouch(final View view, MotionEvent event) {
if (event.getAction() == MotionEvent.ACTION_UP) {
view.requestFocus();
//MyApplication.hideSoftInputFrom(context, view);
view.performClick();
}
return true;
}
示例7: selectTab
import android.view.View; //导入方法依赖的package包/类
public void selectTab(int num) {
if (num < 0 || num >= tabCount) {
return;
}
View tab = tabsContainer.getChildAt(num);
if (Build.VERSION.SDK_INT >= 15) {
tab.callOnClick();
} else {
tab.performClick();
}
}
示例8: onTouch
import android.view.View; //导入方法依赖的package包/类
private boolean onTouch(View v, MotionEvent event) {
if (parent.isEmpty()) {
return false;
}
animator.cancel();
switch (event.getAction()) {
case MotionEvent.ACTION_DOWN:
initialTouchX = event.getRawX();
initialTouchY = event.getRawY();
startTimeMS = event.getEventTime();
onMoveStart(v);
v.setPressed(true);
return true;
case MotionEvent.ACTION_MOVE:
animator.cancel();
onMove(v, event.getRawX() - initialTouchX, event.getRawY() - initialTouchY);
return true;
case MotionEvent.ACTION_UP:
v.setPressed(false);
onMoveEnd(v);
final long downTimeMS = event.getEventTime() - startTimeMS;
final float halfButtonSize = Math.min(v.getHeight(), v.getWidth()) / 2f;
final boolean wasClicked = downTimeMS < CLICK_MAX_DURATION_MS
&& ViewUtil.distance(initialTouchX, initialTouchY, event.getRawX(), event.getRawY()) < halfButtonSize;
if (wasClicked) {
v.performClick();
}
return true;
default:
return true;
}
}
示例9: onTouch
import android.view.View; //导入方法依赖的package包/类
@Override
public boolean onTouch(final View view, MotionEvent event) {
if (event.getAction() == MotionEvent.ACTION_UP) {
view.requestFocus();
Utils.hideSoftInputFrom(context, view);
view.performClick();
}
return true;
}
示例10: performClick
import android.view.View; //导入方法依赖的package包/类
public void performClick(int adapterPosition) {
if (listView != null) {
RecyclerView.ViewHolder holder =
listView.findViewHolderForLayoutPosition(adapterPosition);
if (holder != null) {
View view = holder.itemView;
if (view != null) {
view.performClick();
}
}
}
}
示例11: onTouch
import android.view.View; //导入方法依赖的package包/类
@Override
public boolean onTouch(View view, MotionEvent motionEvent) {
view.performClick();
controller.show();
return false;
}
示例12: perform
import android.view.View; //导入方法依赖的package包/类
@Override
public void perform(UiController uiController, View view) {
view.performClick();
}
示例13: performItemClick
import android.view.View; //导入方法依赖的package包/类
public boolean performItemClick(int position){
View holderView = holders.get(position).itemView;
return holderView.performClick();
}
示例14: clickView
import android.view.View; //导入方法依赖的package包/类
/**
* 单击某个View
*/
public void clickView(View view) {
if (view != null) {
view.performClick();
}
}
示例15: inflaterOthersView
import android.view.View; //导入方法依赖的package包/类
private View inflaterOthersView() {
final View othersView = View.inflate(this.context, ResourceUtil.getLayoutResource(this.context, "lepay_cashier_paychannel_other"), null);
ImageView itemIcon = (ImageView) othersView.findViewById(ResourceUtil.getIdResource(this.context, "lepay_paychannel_item_icon"));
TextView itemTitle = (TextView) othersView.findViewById(ResourceUtil.getIdResource(this.context, "lepay_paychannel_item_title"));
final ImageView arrawicon = (ImageView) othersView.findViewById(ResourceUtil.getIdResource(this.context, "lepay_cashier_paytype_other_selector_icon"));
arrawicon.setImageResource(ResourceUtil.getDrawableResource(this.context, "icon_down"));
itemIcon.setImageResource(ResourceUtil.getDrawableResource(this.context, "lepay_icon_more"));
itemTitle.setText(ResourceUtil.getStringResource(this.context, "lepay_ohters_paytype"));
othersView.setTag(Boolean.FALSE);
othersView.setOnClickListener(new OnClickListener() {
public void onClick(View view) {
int count;
int i;
if (((Boolean) view.getTag()).booleanValue()) {
arrawicon.setImageResource(ResourceUtil.getDrawableResource(CashierAcitivity.this.context, "icon_down"));
count = CashierAcitivity.this.lepay_cashier_paytype_list.getChildCount();
for (i = 0; i < count; i++) {
View v = CashierAcitivity.this.lepay_cashier_paytype_list.getChildAt(i);
CheckBox checkBox = (CheckBox) v.findViewById(ResourceUtil.getIdResource(CashierAcitivity.this, "lepay_paychannel_item_checkbox"));
if (checkBox != null) {
if (((Boolean) checkBox.getTag()).booleanValue()) {
v.setVisibility(8);
} else {
v.setVisibility(0);
}
}
}
othersView.setTag(Boolean.FALSE);
return;
}
arrawicon.setImageResource(ResourceUtil.getDrawableResource(CashierAcitivity.this.context, "icon_up"));
count = CashierAcitivity.this.lepay_cashier_paytype_list.getChildCount();
for (i = 0; i < count; i++) {
CashierAcitivity.this.lepay_cashier_paytype_list.getChildAt(i).setVisibility(0);
}
othersView.setTag(Boolean.TRUE);
}
});
othersView.performClick();
othersView.performClick();
return othersView;
}