如果弃用AbsoluteLayout,我可以使用什么而不是它?
我已经完成了一个使用AbsoluteLayout的应用程序,但它不适用于不同的屏幕分辨率.我使用是因为我可以设置按钮的X和Y位置.我可以使用其他布局设置按钮的位置吗?
我如何制作一个处理我的一些图像的数组,以便我可以像这样使用它?:
ImageView.setImageResource(image[1]);
Run Code Online (Sandbox Code Playgroud)
我希望我解释得很好......
我有一个非常简单的自定义对话框,我不想添加一个肯定的按钮,而不必修改XML文件,就像你使用AlertDialog一样,但我不知道是否可能.这是代码:
final Dialog dialog = new Dialog(MyActivity.this);
dialog.requestWindowFeature(Window.FEATURE_LEFT_ICON);
dialog.setContentView(R.layout.dialog);
dialog.setTitle("Settings");
dialog.show();
Run Code Online (Sandbox Code Playgroud) 我想制作一个顺序动画,其中两个按钮缩小,直到它们消失,然后它们再次增长到原始大小.当我运行它时,按钮只是消失而没有任何动画
<?xml version="1.0" encoding="utf-8"?>
<set xmlns:android="http://schemas.android.com/apk/res/android"
android:interpolator="@android:anim/accelerate_decelerate_interpolator"
android:fillAfter="true">
<scale
android:fromXScale="1"
android:toXScale="0"
android:fromYScale="1"
android:toYScale="0"
android:duration="400"
android:pivotX="50%"
android:pivotY="50%"
/>
<scale
android:startOffset="700"
android:fromXScale="0"
android:toXScale="1"
android:fromYScale="0"
android:toYScale="1"
android:duration="400"
android:pivotX="50%"
android:pivotY="50%"
/>
</set>
Run Code Online (Sandbox Code Playgroud)
Animation sgAnimation = AnimationUtils.loadAnimation(getApplicationContext(), R.anim.shrink_grow);
btPrimary.startAnimation(sgAnimation);
btSecondary.startAnimation(sgAnimation);
Run Code Online (Sandbox Code Playgroud)