本文整理匯總了Java中android.support.v4.view.ViewCompat.setY方法的典型用法代碼示例。如果您正苦於以下問題:Java ViewCompat.setY方法的具體用法?Java ViewCompat.setY怎麽用?Java ViewCompat.setY使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類android.support.v4.view.ViewCompat
的用法示例。
在下文中一共展示了ViewCompat.setY方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: setY
import android.support.v4.view.ViewCompat; //導入方法依賴的package包/類
public static void setY(final @NonNull View v, final int y) {
if (VERSION.SDK_INT >= 11) {
ViewCompat.setY(v, y);
} else {
ViewGroup.MarginLayoutParams params = (ViewGroup.MarginLayoutParams)v.getLayoutParams();
params.topMargin = y;
v.setLayoutParams(params);
}
}
示例2: onItemViewHeightChanged
import android.support.v4.view.ViewCompat; //導入方法依賴的package包/類
void onItemViewHeightChanged(int newHeight) {
if ((prevHeight != 0) && (newHeight != prevHeight)) {
final View view = getInnerLayout();
ViewCompat.setY(view, ViewCompat.getY(view) - (prevHeight - newHeight));
}
prevHeight = newHeight;
}
示例3: updateMaxValue
import android.support.v4.view.ViewCompat; //導入方法依賴的package包/類
private static void updateMaxValue(final View targetView,
final float startScaleX, final float startScaleY,
final Point startPoint,
final Point endPoint,
float fraction) {
ViewCompat.setScaleX(targetView, startScaleX + (1 - startScaleX) * fraction);
ViewCompat.setScaleY(targetView, startScaleY + (1 - startScaleY) * fraction);
ViewCompat.setX(targetView, (startPoint.x + (endPoint.x - startPoint.x) * fraction) - targetView.getMeasuredWidth() / 2);
ViewCompat.setY(targetView, (startPoint.y + (endPoint.y - startPoint.y) * fraction) - targetView.getMeasuredHeight() / 2);
}
示例4: resetInnerLayoutOffset
import android.support.v4.view.ViewCompat; //導入方法依賴的package包/類
void resetInnerLayoutOffset() {
ViewCompat.setY(getInnerLayout(), 0);
}