本文整理汇总了Java中android.view.View.setLeft方法的典型用法代码示例。如果您正苦于以下问题:Java View.setLeft方法的具体用法?Java View.setLeft怎么用?Java View.setLeft使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类android.view.View
的用法示例。
在下文中一共展示了View.setLeft方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: customRequestLayout
import android.view.View; //导入方法依赖的package包/类
public void customRequestLayout() {
int nLeft = getFirstItemLeft();
int nRight;
for (int i = findFirstVisibleItemPosition(); i < findLastVisibleItemPosition() + 1; i++) {
nRight = nLeft + getCacheWidth(i);
View columnHeader = findViewByPosition(i);
columnHeader.setLeft(nLeft);
columnHeader.setRight(nRight);
layoutDecoratedWithMargins(columnHeader, columnHeader.getLeft(), columnHeader.getTop
(), columnHeader.getRight(), columnHeader.getBottom());
nLeft = nRight + 1;
}
}
示例2: fit2
import android.view.View; //导入方法依赖的package包/类
private void fit2(int p_nXPosition, int p_nYPosition, int p_nColumnCachedWidth, View
p_jColumn) {
CellRecyclerView child = (CellRecyclerView) findViewByPosition(p_nYPosition);
if (child != null) {
ColumnLayoutManager childLayoutManager = (ColumnLayoutManager) child.getLayoutManager();
int nCellCacheWidth = childLayoutManager.getCacheWidth(p_nXPosition);
View cell = childLayoutManager.findViewByPosition(p_nXPosition);
// Control whether the cell needs to be fitted by column header or not.
if (cell != null) {
if (nCellCacheWidth != p_nColumnCachedWidth || m_bNeedSetLeft) {
// This is just for setting width value
if (nCellCacheWidth != p_nColumnCachedWidth) {
nCellCacheWidth = p_nColumnCachedWidth;
TableViewUtils.setWidth(cell, nCellCacheWidth);
childLayoutManager.setCacheWidth(p_nXPosition, nCellCacheWidth);
}
// The left & right values of Column header can be considered. Because this
// method will be worked
// after drawing process of main thread.
if (p_jColumn.getLeft() != cell.getLeft() || p_jColumn.getRight() != cell
.getRight()) {
// TODO: + 1 is for decoration item. It should be gotten from a generic
// method of layoutManager
// Set right & left values
cell.setLeft(p_jColumn.getLeft());
cell.setRight(p_jColumn.getRight() + 1);
childLayoutManager.layoutDecoratedWithMargins(cell, cell.getLeft(), cell
.getTop(), cell.getRight(), cell.getBottom());
m_bNeedSetLeft = true;
}
}
}
}
}
示例3: set
import android.view.View; //导入方法依赖的package包/类
@Override
public void set(View view, Integer left) {
view.setLeft(left);
}
示例4: getBoundsAnimator
import android.view.View; //导入方法依赖的package包/类
/**
* Returns an animator that animates the bounds of a single view.
*/
public static Animator getBoundsAnimator(View view, int fromLeft, int fromTop, int fromRight,
int fromBottom, int toLeft, int toTop, int toRight, int toBottom) {
view.setLeft(fromLeft);
view.setTop(fromTop);
view.setRight(fromRight);
view.setBottom(fromBottom);
return ObjectAnimator.ofPropertyValuesHolder(view,
PropertyValuesHolder.ofInt(VIEW_LEFT, toLeft),
PropertyValuesHolder.ofInt(VIEW_TOP, toTop),
PropertyValuesHolder.ofInt(VIEW_RIGHT, toRight),
PropertyValuesHolder.ofInt(VIEW_BOTTOM, toBottom));
}
示例5: fit
import android.view.View; //导入方法依赖的package包/类
private int fit(int p_nXPosition, int p_nYPosition, int p_nLeft, int p_nRight, int
p_nColumnCachedWidth) {
CellRecyclerView child = (CellRecyclerView) findViewByPosition(p_nYPosition);
if (child != null) {
ColumnLayoutManager childLayoutManager = (ColumnLayoutManager) child.getLayoutManager();
int nCellCacheWidth = childLayoutManager.getCacheWidth(p_nXPosition);
View cell = childLayoutManager.findViewByPosition(p_nXPosition);
// Control whether the cell needs to be fitted by column header or not.
if (cell != null) {
if (nCellCacheWidth != p_nColumnCachedWidth || m_bNeedSetLeft) {
// This is just for setting width value
if (nCellCacheWidth != p_nColumnCachedWidth) {
nCellCacheWidth = p_nColumnCachedWidth;
TableViewUtils.setWidth(cell, nCellCacheWidth);
childLayoutManager.setCacheWidth(p_nXPosition, nCellCacheWidth);
}
// Even if the cached values are same, the left & right value wouldn't change.
// m_bNeedSetLeftValue & the below lines for it.
if (p_nLeft != IGNORE_LEFT && cell.getLeft() != p_nLeft) {
// Calculate scroll distance
int nScrollX = Math.max(cell.getLeft(), p_nLeft) - Math.min(cell.getLeft
(), p_nLeft);
cell.setLeft(p_nLeft);
// It shouldn't be scroll horizontally and the problem is gotten just for
// first visible item.
if (m_iHorizontalListener.getScrollPositionOffset() > 0 && p_nXPosition
== childLayoutManager.findFirstVisibleItemPosition() &&
m_iCellRecyclerView.getScrollState() != RecyclerView
.SCROLL_STATE_IDLE) { //
m_iHorizontalListener.setScrollPositionOffset(m_iHorizontalListener
.getScrollPositionOffset() + nScrollX);
childLayoutManager.scrollToPositionWithOffset(m_iHorizontalListener
.getScrollPosition(), m_iHorizontalListener
.getScrollPositionOffset());
}
}
if (cell.getWidth() != nCellCacheWidth) {
if (p_nLeft != IGNORE_LEFT) {
// TODO: + 1 is for decoration item. It should be gotten from a
// generic method of layoutManager
// Set right
p_nRight = cell.getLeft() + nCellCacheWidth + 1;
cell.setRight(p_nRight);
childLayoutManager.layoutDecoratedWithMargins(cell, cell.getLeft(),
cell.getTop(), cell.getRight(), cell.getBottom());
}
m_bNeedSetLeft = true;
}
}
}
} else {
Log.e(LOG_TAG, " x: " + p_nXPosition + " y: " + p_nYPosition + " child is null. " +
"Because first visible item position is " + findFirstVisibleItemPosition());
}
return p_nRight;
}