Zip*_*ppy 0 xml android splash-screen
我知道如何通过surfaceView这样做,我想知道我是否应该顺其自然.
我只是想创建一个闪屏,它有一个全屏图像,顶部有一个不透明的图像(经过短暂的延迟).我无法弄清楚如何在XML代码中完成此操作.
这就是我的......
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
>
<ImageView
android:id="@+id/lightDot"
android:src="@drawable/splashlight"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:background="@null"
/>
<ImageView
android:id="@+id/bGround"
android:src="@drawable/splash"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
/>
Run Code Online (Sandbox Code Playgroud)
所以我的'lightDot'对象是半透明的,我希望在短暂延迟后将其覆盖在我的bGround资源之上.
这是我的代码:
import android.app.Activity;
import android.content.Intent;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.os.Bundle;
import android.util.Log;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.ImageView;
public class SplashAct extends Activity implements OnClickListener{
Button mainButton;
Button lightDot;
ImageView background;
ImageView light;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.splashscreen);
background = (ImageView)findViewById(R.id.bGround);
light = (ImageView)findViewById(R.id.lightDot);
background.setOnClickListener(this);
}
@Override
public void onClick(View arg0) {
//finish();
Intent toMainGame = new Intent(this, ActOptions.class);
startActivity(toMainGame);
}
}
Run Code Online (Sandbox Code Playgroud)
谢谢.
你想要的是一个FrameLayout.
子视图以堆栈形式绘制,最近添加的子项位于顶部.
您可以更好地了解叠加层使用的位置layout_gravity,但听起来这就是您需要的全部内容.
<FrameLayout
android:layout_width="fill_parent"
android:layout_height="fill_parent" >
<ImageView
android:id="@+id/image"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:src="@drawable/image" >
</ImageView>
<ImageView
android:id="@+id/overlay"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:src="@drawable/overlay"/>
</FrameLayout>
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
6161 次 |
| 最近记录: |