【发布时间】:2021-04-07 23:38:30
【问题描述】:
应用程序未启动。我看过 youtube 的启动画面教程
<androidx.constraintlayout.widget.ConstraintLayout 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="match_parent"
tools:context=".MainActivity"
android:background="#fece2f">
<ImageView
android:id="@+id/imageView"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginStart="10dp"
android:layout_marginTop="104dp"
android:layout_marginEnd="10dp"
android:contentDescription="@string/todo"
android:src="@drawable/logo"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.0"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<TextView
android:id="@+id/textView2"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginTop="496dp"
android:fontFamily="@font/bangers"
android:text="@string/TARZERA"
android:textAlignment="center"
android:textSize="70sp"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="1.0"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"/>
<TextView
android:id="@+id/textView3"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:fontFamily="@font/antic"
android:text="@string/Manifacturer_of_Scarves_Stoles"
android:textAlignment="center"
android:textSize="18sp"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.502"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/textView2" />
这里是主要活动
</androidx.constraintlayout.widget.ConstraintLayout>
{
private static int SPLASH_SCREEN = 5000;
//variables
Animation topAnim, bottomAnim;
ImageView imageView;
TextView logo, slogan;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,WindowManager.LayoutParams.FLAG_FULLSCREEN);
setContentView(R.layout.activity_main);
//Animations
topAnim = AnimationUtils.loadAnimation(this,R.anim.top_animation);
bottomAnim = AnimationUtils.loadAnimation(this,R.anim.bottom_animation);
//Hooks
imageView = findViewById(R.id.imageView);
logo = findViewById(R.id.textView);
slogan = findViewById(R.id.textView2);
imageView.setAnimation(topAnim);
logo.setAnimation(bottomAnim);
slogan.setAnimation(bottomAnim);
new Handler().postDelayed(new Runnable() {
@Override
public void run() {
Intent intent = new Intent(MainActivity.this,Dashboard.class);
startActivity(intent);
finish();
}
},SPLASH_SCREEN);
}
}
<?xml version="1.0" encoding="utf-8"?>
<set xmlns:android="http://schemas.android.com/apk/res/android">
<translate
android:fromXDelta="0%"
android:fromYDelta="-50%"
android:duration="2000"/>
<alpha
android:fromAlpha="0.1"
android:toAlpha="1.0"
android:duration="1500"/>
</set>
<?xml version="1.0" encoding="utf-8"?>
<set xmlns:android="http://schemas.android.com/apk/res/android">
<translate
android:fromXDelta="0%"
android:fromYDelta="100%"
android:duration="1500"/>
<alpha
android:fromAlpha="0.1"
android:toAlpha="1.0"
android:duration="1500"/>
</set>
主要问题是我现在无法在模拟器中启动应用程序,也尝试了一切以使其工作但仍然无法成功。启动应用程序时,它显示一长串错误,但没有一个是任何编码错误,而是启动问题
【问题讨论】:
-
欢迎来到 Stack Overflow。请与我们分享错误日志。
-
请不要使用标签
android-studio。这个标签是针对 Android Studio 产品的问题和问题。您的问题是一个通用的 Android 问题,与 Android Studio 无关。 -
请编辑您的问题并将错误消息、异常、堆栈跟踪从 logcat 复制/粘贴到问题中。
标签: java android xml android-activity