<ViewFlipper
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:measureAllChildren="false">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="100dp"/>
</RelativeLayout>
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="200dp">
</RelativeLayout>
</ViewFlipper>
我有鳍状肢。并且动画可以改变视图效果:
Animation slideDown = AnimationUtils.loadAnimation(getActivity(), android.R.anim.slide_in_left);
slideDown.setDuration(900);
Animation slideUp = AnimationUtils.loadAnimation(getActivity(), android.R.anim.slide_out_right);
slideUp.setDuration(300);
mReceiverFlipper.setInAnimation(slideDown);
mReceiverFlipper.setOutAnimation(slideUp);
我的问题是我无法垂直动画 flipperView 。由于两个孩子的视图有不同的高度。当我在childViews
fipperView
animation
之间翻转,在没有parseFloat($("#size").val());
的情况下调整身高。
那么,当他的尺寸发生变化时,我怎样才能为flipperView设置动画?
答案 0 :(得分:0)
您可以使用android:animateLayoutChanges
属性。
在ViewFlipper上添加属性<ViewFlipper android:animateLayoutChanges="true" ...
并将其设置为true。
(((ViewFlipper) findViewById(/* your viewflipper id here*/)).getLayoutTransition().enableTransitionType(LayoutTransition.CHANGING)
)
然后在代码中,您需要添加以下行以启用动画:
findViewById<ViewFlipper>(/* your viewflipper id here*/).layoutTransition.enableTransitionType(LayoutTransition.CHANGING)
或在科特林:
public static void TextToWord(string pWordDoc, string pMergeField, string pValue)
{
Object oMissing = System.Reflection.Missing.Value;
Object oTrue = true;
Object oFalse = false;
Word.Application oWord = new Word.Application();
Word.Document oWordDoc = new Word.Document();
oWord.Visible = true;
Object oTemplatePath = pWordDoc;**//Here instead of doc file or doc file path I have a blobpath**
//Something like this
//Object oTemplatePath = "https://bviewstorage.blob.core.windows.net/909347fb-e9ed-4f0c-9ef9-
//347ad017f7f9/localsiteuploads/92f9e761-65e2-46f9-82a1-a05fa9e26cda/file-sample_100kB-53c5fb9c-931d-
//4f95-b2cb-48b3a38e6f29.doc";
oWordDoc = oWord.Documents.Add(ref oTemplatePath, ref oMissing, ref oMissing, ref oMissing);
foreach (Word.Field myMergeField in oWordDoc.Fields)
{
Word.Range rngFieldCode = myMergeField.Code;
String fieldText = rngFieldCode.Text;
if (fieldText.StartsWith(" MERGEFIELD"))
{
Int32 endMerge = fieldText.IndexOf("\\");
Int32 fieldNameLength = fieldText.Length - endMerge;
String fieldName = fieldText.Substring(11, endMerge - 11);
fieldName = fieldName.Trim();
if (fieldName == pMergeField)
{
myMergeField.Select();
oWord.Selection.TypeText(pValue);
}
}
}
来源:https://proandroiddev.com/the-little-secret-of-android-animatelayoutchanges-e4caab2fddec