我有一个LinearLayout我希望显示或隐藏的内容Animation,只要我改变其可见性,就会向上或向下推动布局.
我在那里看到了一些样品,但它们都不适合我的需要.
我为动画创建了两个xml文件,但是当我更改a的可见性时,我不知道如何启动它们LinearLayout.
我AlertDialog在我的活动中做了一个简单的事:
View view = layoutInflater.inflate(R.layout.my_dialog, null);
AlertDialog infoDialog = new AlertDialog.Builder(MyActivity.this)
.setView(view)
.create();
infoDialog.show();
Run Code Online (Sandbox Code Playgroud)
使用上面的代码,对话框显示在屏幕的中心(大约).
我想知道,如何自定义对话框位置以使其显示在顶部操作栏下?(无论如何改变对话的重力或某些东西?)以及如何根据我的代码做到这一点?
android android-widget android-emulator android-intent android-layout
我在Android中创建了一个视图,我需要从下到上为其设置动画,反之亦然.当我点击时,ImageView我需要RelativeLayout从底部到顶部动画完整,并且它成功了.但是,当我再次点击ImageView它并没有向下移动时.此外,当我点击其原始位置时,当我单击ImageView动画的原始位置时,但从RelativeLayout原始位置向下移动而不是从上到下.
这是我的代码:
ImageView iv_header;
RelativeLayout rl_footer;
boolean isBottom = true;
@Override
protected void onCreate(Bundle savedInstanceState) {
// TODO Auto-generated method stub
super.onCreate(savedInstanceState);
setContentView(R.layout.rateus_layout);
rl_footer = (RelativeLayout) findViewById(R.id.rl_footer);
iv_header = (ImageView) findViewById(R.id.iv_up_arrow);
iv_header.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
// TODO Auto-generated method stub
if (isBottom) {
FooterAnimation();
isBottom = false;
} else {
headerAnimation();
isBottom = true;
}
}
});
}
public void FooterAnimation() {
Animation hide = …Run Code Online (Sandbox Code Playgroud) 嘿,我需要从屏幕底部的一些滑动菜单.我看到SlidingDrawer已被弃用.
那么什么是SlidingDrawer的替代品,我可以用它从底部向上滑动.
我知道有NavigationDrawer,但我认为这只能用于从左到右滑动和反向滑动,或者?
我有一个带有NestedScrollView的底页(见下文).当我按下FAB按钮时,我想让这个NestedScrollView中的某些部分不可见.但是当我将一些线性布局的可见性改为GONE时,底片会从顶部飞走.看这里:
您可以从https://github.com/Tanrikut/BottomSheetExample获取整个代码
我的变更可见性方法:
private void changeVisibility() {
subtitleLayout.setVisibility(View.GONE);
coordinateLayout.setVisibility(View.GONE);
timeLayout.setVisibility(View.GONE);
}
Run Code Online (Sandbox Code Playgroud)
我的NestedScrollView xml:
<?xml version="1.0" encoding="utf-8"?>
<android.support.v4.widget.NestedScrollView xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:behavior_peekHeight="120dp"
app:layout_behavior="android.support.design.widget.BottomSheetBehavior"
android:id="@+id/bottom_sheet_main">
<FrameLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="28dp"
android:background="@android:color/white"
android:animateLayoutChanges="true"
android:orientation="vertical"
>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:paddingLeft="10dp"
android:paddingStart="10dp"
android:paddingTop="@dimen/activity_horizontal_margin">
<TextView
style="@style/TextAppearance.AppCompat.Headline"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="Dandelion Chocolate"
android:id="@+id/title" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="@dimen/activity_horizontal_margin"
android:layout_marginTop="16dp"
android:orientation="horizontal"
android:id="@+id/subtitleLayout">
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="@+id/subtitle"
android:text="Subtitle" />
</LinearLayout>
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:padding="@dimen/activity_horizontal_margin"
android:id="@+id/coordinateLayout">
<ImageButton
android:layout_width="24dp"
android:layout_height="24dp"
android:alpha="0.36"
android:src="@drawable/ic_room_24dp"
android:background="@null" …Run Code Online (Sandbox Code Playgroud) 其实我有一个Linear Layout是matchParent(在width和height),现在我需要创建另一个layout(低于linearLayout),必须是不可见的最初。
当我的活动运行时,我想为隐藏的布局设置动画。
隐藏物layout必须从下到上。我不知道如何实现这个动画?我不知道如何创建最初不可见的布局,并且在延迟后必须从屏幕下方显示并向上显示?
这是我的xml文件代码
<?xml version="1.0" encoding="utf-8"?>
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical" >
<LinearLayout
android:id="@+id/imageupLayout"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical" >
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:gravity="center"
android:orientation="vertical" >
<ImageView
android:id="@+id/imgview"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:background="@drawable/logo" />
</LinearLayout>
<LinearLayout
android:id="@+id/hided_layout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="bottom"
android:background="#56a24b"
android:orientation="vertical"
android:visibility="visible" >
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_marginTop="15dip"
android:background="@drawable/btn_bg"
android:gravity="center" >
<Button
android:id="@+id/btn_login"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_margin="2dip"
android:background="@drawable/btn_login" />
</LinearLayout>
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center" …Run Code Online (Sandbox Code Playgroud) 我在textView他们每个人身上都有很多人,tableLayout而且visibility.GONE在一开始就有.我正在尝试扩展tableLayout属于a的textView时候textView点击它.我已经alpha为tableLayouts和translate动画分配了动画,这些动画textView在被点击的动画下方.
由于我的大小tableLayout不同,我必须
在新动画中单独设置toYDelta和fromYDelta分别点击textView!我认为这是完全难的代码!!!
我的问题是:有没有任何方法可以用它来toYDelta编程修改may代码?
或者任何人都可以帮助我以其他方式做到这一点吗?