本文整理汇总了C#中android.setLayoutParams方法的典型用法代码示例。如果您正苦于以下问题:C# android.setLayoutParams方法的具体用法?C# android.setLayoutParams怎么用?C# android.setLayoutParams使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类android
的用法示例。
在下文中一共展示了android.setLayoutParams方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: addViewInner
private void addViewInner(android.view.View child, int index, android.view.ViewGroup
.LayoutParams @params, bool preventRequestLayout)
{
if (mTransition != null)
{
// Don't prevent other add transitions from completing, but cancel remove
// transitions to let them complete the process before we add to the container
mTransition.cancel(android.animation.LayoutTransition.DISAPPEARING);
}
if (child.getParent() != null)
{
throw new System.InvalidOperationException("The specified child already has a parent. "
+ "You must call removeView() on the child's parent first.");
}
if (mTransition != null)
{
mTransition.addChild(this, child);
}
if (!checkLayoutParams(@params))
{
@params = generateLayoutParams(@params);
}
if (preventRequestLayout)
{
child.mLayoutParams = @params;
}
else
{
child.setLayoutParams(@params);
}
if (index < 0)
{
index = mChildrenCount;
}
addInArray(child, index);
// tell our children
if (preventRequestLayout)
{
child.assignParent(this);
}
else
{
child.mParent = this;
}
if (child.hasFocus())
{
requestChildFocus(child, child.findFocus());
}
android.view.View.AttachInfo ai = mAttachInfo;
if (ai != null && (mGroupFlags & FLAG_PREVENT_DISPATCH_ATTACHED_TO_WINDOW) == 0)
{
bool lastKeepOn = ai.mKeepScreenOn;
ai.mKeepScreenOn = false;
child.dispatchAttachedToWindow(mAttachInfo, (mViewFlags & VISIBILITY_MASK));
if (ai.mKeepScreenOn)
{
needGlobalAttributesUpdate(true);
}
ai.mKeepScreenOn = lastKeepOn;
}
onViewAdded(child);
if ((child.mViewFlags & DUPLICATE_PARENT_STATE) == DUPLICATE_PARENT_STATE)
{
mGroupFlags |= FLAG_NOTIFY_CHILDREN_ON_DRAWABLE_STATE_CHANGE;
}
}
示例2: updateViewLayout
public virtual void updateViewLayout(android.view.View view, android.view.ViewGroup
.LayoutParams @params)
{
if (!checkLayoutParams(@params))
{
throw new System.ArgumentException("Invalid LayoutParams supplied to " + this);
}
if (view.mParent != this)
{
throw new System.ArgumentException("Given view not a child of " + this);
}
view.setLayoutParams(@params);
}
示例3: addView
public override void addView(android.view.View child)
{
if (child.getLayoutParams() == null)
{
android.widget.LinearLayout.LayoutParams lp = new android.widget.LinearLayout.LayoutParams
(0, android.view.ViewGroup.LayoutParams.MATCH_PARENT, 1.0f);
lp.setMargins(0, 0, 0, 0);
child.setLayoutParams(lp);
}
// Ensure you can navigate to the tab with the keyboard, and you can touch it
child.setFocusable(true);
child.setClickable(true);
base.addView(child);
// TODO: detect this via geometry with a tabwidget listener rather
// than potentially interfere with the view's listener
child.setOnClickListener(new android.widget.TabWidget.TabClickListener(this, getTabCount
() - 1));
child.setOnFocusChangeListener(this);
}
示例4: updateViewLayout
public virtual void updateViewLayout(android.view.View view, android.view.ViewGroup
.LayoutParams @params)
{
if (!(@params is android.view.WindowManagerClass.LayoutParams))
{
throw new System.ArgumentException("Params must be WindowManager.LayoutParams");
}
android.view.WindowManagerClass.LayoutParams wparams = (android.view.WindowManagerClass
.LayoutParams)@params;
view.setLayoutParams(wparams);
lock (this)
{
int index = findViewLocked(view, true);
android.view.ViewRootImpl root = mRoots[index];
mParams[index] = wparams;
root.setLayoutParams(wparams, false);
}
}
示例5: addView
private void addView(android.view.View view, android.view.ViewGroup.LayoutParams
@params, android.view.CompatibilityInfoHolder cih, bool nest)
{
if (false)
{
android.util.Log.v("WindowManager", "addView view=" + view);
}
if (!(@params is android.view.WindowManagerClass.LayoutParams))
{
throw new System.ArgumentException("Params must be WindowManager.LayoutParams");
}
android.view.WindowManagerClass.LayoutParams wparams = (android.view.WindowManagerClass
.LayoutParams)@params;
android.view.ViewRootImpl root;
android.view.View panelParentView = null;
lock (this)
{
// Here's an odd/questionable case: if someone tries to add a
// view multiple times, then we simply bump up a nesting count
// and they need to remove the view the corresponding number of
// times to have it actually removed from the window manager.
// This is useful specifically for the notification manager,
// which can continually add/remove the same view as a
// notification gets updated.
int index = findViewLocked(view, false);
if (index >= 0)
{
if (!nest)
{
throw new System.InvalidOperationException("View " + view + " has already been added to the window manager."
);
}
root = mRoots[index];
root.mAddNesting++;
// Update layout parameters.
view.setLayoutParams(wparams);
root.setLayoutParams(wparams, true);
return;
}
// If this is a panel window, then find the window it is being
// attached to for future reference.
if (wparams.type >= android.view.WindowManagerClass.LayoutParams.FIRST_SUB_WINDOW
&& wparams.type <= android.view.WindowManagerClass.LayoutParams.LAST_SUB_WINDOW)
{
int count = mViews != null ? mViews.Length : 0;
{
for (int i = 0; i < count; i++)
{
if (mRoots[i].mWindow.asBinder() == wparams.token)
{
panelParentView = mViews[i];
}
}
}
}
root = new android.view.ViewRootImpl(view.getContext());
root.mAddNesting = 1;
if (cih == null)
{
root.mCompatibilityInfo = new android.view.CompatibilityInfoHolder();
}
else
{
root.mCompatibilityInfo = cih;
}
view.setLayoutParams(wparams);
if (mViews == null)
{
index = 1;
mViews = new android.view.View[1];
mRoots = new android.view.ViewRootImpl[1];
mParams = new android.view.WindowManagerClass.LayoutParams[1];
}
else
{
index = mViews.Length + 1;
object[] old = mViews;
mViews = new android.view.View[index];
System.Array.Copy(old, 0, mViews, 0, index - 1);
old = mRoots;
mRoots = new android.view.ViewRootImpl[index];
System.Array.Copy(old, 0, mRoots, 0, index - 1);
old = mParams;
mParams = new android.view.WindowManagerClass.LayoutParams[index];
System.Array.Copy(old, 0, mParams, 0, index - 1);
}
index--;
mViews[index] = view;
mRoots[index] = root;
mParams[index] = wparams;
}
// do this last because it fires off messages to start doing things
root.setView(view, wparams, panelParentView);
}
示例6: setCustomView
public override void setCustomView(android.view.View view, android.app.ActionBar.
LayoutParams layoutParams)
{
view.setLayoutParams(layoutParams);
mActionView.setCustomNavigationView(view);
}