本文整理汇总了Java中android.view.View.equals方法的典型用法代码示例。如果您正苦于以下问题:Java View.equals方法的具体用法?Java View.equals怎么用?Java View.equals使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类android.view.View
的用法示例。
在下文中一共展示了View.equals方法的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: childAtPosition
import android.view.View; //导入方法依赖的package包/类
private static Matcher<View> childAtPosition(
final Matcher<View> parentMatcher, final int position) {
return new TypeSafeMatcher<View>() {
@Override
public void describeTo(Description description) {
description.appendText("Child at position " + position + " in parent ");
parentMatcher.describeTo(description);
}
@Override
public boolean matchesSafely(View view) {
ViewParent parent = view.getParent();
return parent instanceof ViewGroup && parentMatcher.matches(parent)
&& view.equals(((ViewGroup) parent).getChildAt(position));
}
};
}
示例2: ensureTarget
import android.view.View; //导入方法依赖的package包/类
private void ensureTarget() {
// Don't bother getting the parent height if the parent hasn't been laid
// out yet.
if (mTarget == null) {
for (int i = 0; i < getChildCount(); i++) {
View child = getChildAt(i);
if (!child.equals(tCircleView) && !child.equals(bCircleView)) {
mTarget = child;
break;
}
}
}
}
示例3: onClick
import android.view.View; //导入方法依赖的package包/类
public void onClick(View v) {
if (v.equals(tvCancel)) {
cancelAndFinish();
} else if (v.equals(tvShare)) {
sp.setText(etContent.getText().toString().trim());
shareAndFinish();
} else if (v.equals(aivThumb)) {
showThumb(thumb);
} else if (v.equals(xvRemove)) {
maxBodyHeight = 0;
rlThumb.setVisibility(View.GONE);
llPage.measure(0, 0);
onTextChanged(etContent.getText(), 0, 0, 0);
removeThumb();
} else if (v.equals(tvAt)) {
showFriendList();
}
}
示例4: onClick
import android.view.View; //导入方法依赖的package包/类
public void onClick(View v) {
if (v.equals(tvCancel)) {
finish();
} else {
ArrayList<String> selected = new ArrayList<String>();
for (int i = 0, size = adapter.getCount(); i < size; i++) {
if (adapter.getItem(i).checked) {
selected.add(adapter.getItem(i).atName);
}
}
HashMap<String, Object> res = new HashMap<String, Object>();
res.put("selected", selected);
res.put("platform", platform);
setResult(res);
finish();
}
}
示例5: onClick
import android.view.View; //导入方法依赖的package包/类
@Override
public void onClick(View view) {
if (view.equals(this.floatingActionButton)) {
MenuItem menuItem = parseMenuItem(this.navigationView);
switch (menuItem.getItemId()) {
case R.id.nav_energy_use_day:
addAlert();
return;
case R.id.nav_energy_use_bill:
addBill();
return;
}
}
}
示例6: onClick
import android.view.View; //导入方法依赖的package包/类
@Override
public void onClick(View v) {
if (v.equals(imCart)){
startFragment(new BasketFragment());
tvActionBar.setText("SEPETİM");
}else if (v.equals(imBack)){
startFragment(new CategoryFragment());
imBack.setVisibility(View.GONE);
}
}
示例7: onClick
import android.view.View; //导入方法依赖的package包/类
@Override
public void onClick(View v) {
if (v.equals(mButtonLeft)) {
mSwipeStack.swipeTopViewToLeft();
} else if (v.equals(mButtonRight)) {
mSwipeStack.swipeTopViewToRight();
}
}
示例8: ensureTarget
import android.view.View; //导入方法依赖的package包/类
private void ensureTarget() {
if (this.mTarget == null) {
int i = 0;
while (i < getChildCount()) {
View child = getChildAt(i);
if (child.equals(this.mCircleView)) {
i++;
} else {
this.mTarget = child;
return;
}
}
}
}
示例9: isViewFromObject
import android.view.View; //导入方法依赖的package包/类
@Override
public boolean isViewFromObject(View view, Object object) {
return view.equals(object);
}
示例10: onViewPositionChanged
import android.view.View; //导入方法依赖的package包/类
/**
* 子view拖拽过程中位置改变的回调
*
* @param changedView 被拖拽的子view
* @param left 距离父布局左边的距离
* @param top 距离父布局上面的距离
* @param dx x方向的偏移量
* @param dy y方向的偏移量
*/
@Override
public void onViewPositionChanged(View changedView, int left, int top, int dx, int dy) {
if (dx == 0) {
return;
}
if (changedView.equals(menu)) {
// 如果拖拽的是menu,布局不变
menu.layout(0, 0, width, height);
// content.layout(marginLeft, 0, marginLeft + width, height);
// 这里如果在屏幕上手指按定,就会出现dx=0,dy=1的情况
content.layout(left, 0, left + width, height);
}
// 如果是内容布局,就随拖拽位移而变化,因为在smoothSlideViewTo中会进行控件边缘和内容边缘之间的移动,所以这里content要随时改变布局
// content.layout(marginLeft, 0, marginLeft + width, height);
// 0~~1之间
float percent = left / (float) range;
float desWidth = (float) (width / 4.0 * (percent - 1));
// 进行内容移动,本身控件位置不变
ViewHelper.setTranslationX(menu, desWidth);
if (SHADOW) {
// ivShadow.layout(marginLeft, 0, marginLeft + width, height);
ivShadow.layout(left, 0, left + width, height);
// ivShadow.setAlpha(percent * 225);
// ViewHelper.setAlpha(ivShadow, percent * 255);
// 阴影效果
float f1 = 1 - percent * 0.5f;
ViewHelper.setScaleX(ivShadow, f1 * 1.2f * (1 - percent * 0.10f));
ViewHelper.setScaleY(ivShadow, f1 * 1.85f * (1 - percent * 0.10f));
}
int dragState = getCurrentState();
if (dragState == DRAG_STATE_OPEN) {
if (mListener != null) {
mListener.onOpenMenu();
}
} else if (dragState == DRAG_STATE_CLOSE) {
if (mListener != null) {
mListener.onCloseMenu();
}
} else {
if (mListener != null) {
mListener.onDrag(changedView, percent);
}
}
}
示例11: isViewFromObject
import android.view.View; //导入方法依赖的package包/类
@Override
public boolean isViewFromObject(View view, Object object) {
return object instanceof ViewHolder
&& view.equals(((ViewHolder) object).itemView);
}
示例12: doExpansion
import android.view.View; //导入方法依赖的package包/类
private void doExpansion() {
int childnum = mDragPos - getFirstVisiblePosition();
if (mDragPos > mSrcDragPos) {
childnum++;
}
int numheaders = getHeaderViewsCount();
View first = getChildAt(mSrcDragPos - getFirstVisiblePosition());
for (int i = 0; ; i++) {
View vv = getChildAt(i);
if (vv == null) {
break;
}
int height = mItemHeightNormal;
int visibility = View.VISIBLE;
if (mDragPos < numheaders && i == numheaders) {
// dragging on top of the header item, so adjust the item below
// instead
if (vv.equals(first)) {
visibility = View.INVISIBLE;
} else {
height = mItemHeightExpanded;
}
} else if (vv.equals(first)) {
// processing the item that is being dragged
if (mDragPos == mSrcDragPos
|| getPositionForView(vv) == getCount() - 1) {
// hovering over the original location
visibility = View.INVISIBLE;
} else {
// not hovering over it
// Ideally the item would be completely gone, but neither
// setting its size to 0 nor settings visibility to GONE
// has the desired effect.
height = 1;
}
} else if (i == childnum) {
if (mDragPos >= numheaders && mDragPos < getCount() - 1) {
height = mItemHeightExpanded;
}
}
ViewGroup.LayoutParams params = vv.getLayoutParams();
params.height = height;
vv.setLayoutParams(params);
vv.setVisibility(visibility);
}
}
示例13: clampViewPositionHorizontal
import android.view.View; //导入方法依赖的package包/类
@Override
public int clampViewPositionHorizontal(View child, int left) {
if (mDragView != null && child.equals(mDragView)) {
if (left > 0 && !mDragView.isBouncePossible()) {
return 0;
}
return left;
}
return 0;
}