我在Dialog布局中使用cachapa / ExpandableLayout,但我遇到了一些意想不到的动画。我的意思是,可扩展的布局不会移动并且平稳地移出,但突然间。
如您所见,我使用************** Exception Text **************
System.UnauthorizedAccessException: Cannot write to the registry key.
at System.ThrowHelper.ThrowUnauthorizedAccessException(ExceptionResource resource)
at Microsoft.Win32.RegistryKey.EnsureWriteable()
at Microsoft.Win32.RegistryKey.SetValue(String name, Object value, RegistryValueKind valueKind)
at Microsoft.Win32.RegistryKey.SetValue(String name, Object value)
at TestingEnvVariables.Form1.GetVariablesButtonClick(Object sender, EventArgs e)
at System.Windows.Forms.Control.OnClick(EventArgs e)
at System.Windows.Forms.Button.OnClick(EventArgs e)
at System.Windows.Forms.Button.OnMouseUp(MouseEventArgs mevent)
at System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons button, Int32 clicks)
at System.Windows.Forms.Control.WndProc(Message& m)
at System.Windows.Forms.ButtonBase.WndProc(Message& m)
at System.Windows.Forms.Button.WndProc(Message& m)
at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
将对话框放在屏幕的BOTTOM上。如果我将其更改为TOP,则动画将fine。但就我而言,我应该把它设置为BOTTOM。我该如何解决?
RES /布局:
<div class="input-group date">
<input type="text" class="form-control pull-right" id="datepicker2" placeholder="Date of Join" ng-model="DateofJoining">
<div class="input-group-addon"></div>
</div>
$('#datepicker2').datepicker({
autoclose: true,
maxDate: new Date()
});
的java
Utils.setWindowGravity(getWindow(), Gravity.BOTTOM);
答案 0 :(得分:1)
我认为改变对话框的大小并不是一个好主意。根据我自己的经验,改变对话框的高度是非常有用的,即使动画工作正常,也会非常笨拙。
我建议您将该界面实现为放置在整个UI上的自定义叠加层。
<?xml version="1.0" encoding="utf-8"?>
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="@+id/scrim"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#6000">
<Button
android:id="@+id/add"
android:layout_width="match_parent"
android:layout_height="40dp"
android:text="Add" />
<net.cachapa.expandablelayout.ExpandableLayout
android:id="@+id/expand_add"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="bottom"
android:orientation="vertical"
app:el_duration="500"
app:el_expanded="false"
app:el_parallax="0">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="?android:windowBackground"
android:orientation="horizontal">
<EditText
android:id="@+id/name"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="1" />
<ImageView
android:id="@+id/submit"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/ic_chevron_right_black_48dp" />
</LinearLayout>
</net.cachapa.expandablelayout.ExpandableLayout>
<!--other views-->
</FrameLayout>
将R.id.scrim设置为关闭ExpandableLayout的点击侦听器,以及当expansionRatio为零时隐藏整个叠加层的ExpansionListener。 通过这种方式,您可以完美地复制您正在使用Dialog查找的行为,但性能要好得多。