动画屏幕可在手机上使用,但不适用于平板电脑

时间:2020-09-30 10:28:21

标签: java android

因此,我为手机制作了第一个动画屏幕,该屏幕非常完美,现在我想在平板电脑上尝试一下,但是崩溃了。 平板电脑是#!/bin/bash INPUT_DIR='/home/user/TestDir' files=( "$INPUT_DIR/"*txt ) crash Log

如上图所示,它位于第Lenovo TAB3 7 Essential / Samsung SM-T550行的第34行。

我尝试setContentView(R.layout.activity_startscreen);我的项目,但是我认为它可能在Clean文件中?

.xml

我显示的活动<?xml version="1.0" encoding="utf-8"?> <LinearLayout 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" android:background="#73FFFFFF" android:orientation="vertical" tools:context=".activitys.Startscreen"> <RelativeLayout android:layout_width="match_parent" android:layout_height="wrap_content"> <View android:id="@+id/first_line" android:layout_width="20dp" android:layout_height="50dp" android:layout_centerHorizontal="true" android:background="@drawable/blue_line" /> <View android:id="@+id/second_line" android:layout_width="20dp" android:layout_height="200dp" android:layout_marginLeft="8dp" android:layout_toRightOf="@id/first_line" android:background="@drawable/gray_line" /> <View android:id="@+id/third_line" android:layout_width="20dp" android:layout_height="150dp" android:layout_marginLeft="8dp" android:layout_toRightOf="@id/second_line" android:background="@drawable/blue_line" /> <View android:id="@+id/fourth_line" android:layout_width="20dp" android:layout_height="250dp" android:layout_marginLeft="8dp" android:layout_toRightOf="@id/third_line" android:background="@drawable/gray_line" /> <View android:id="@+id/fifth_line" android:layout_width="20dp" android:layout_height="100dp" android:layout_marginLeft="8dp" android:layout_toRightOf="@id/fourth_line" android:background="@drawable/blue_line" /> <View android:id="@+id/six_line" android:layout_width="20dp" android:layout_height="50dp" android:layout_marginLeft="8dp" android:layout_toRightOf="@id/fifth_line" android:background="@drawable/gray_line" /> </RelativeLayout> <RelativeLayout android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_marginHorizontal="5dp"> <ImageView android:id="@+id/wrd" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_centerHorizontal="true" app:srcCompat="@drawable/logo_wrd" /> </RelativeLayout> <RelativeLayout android:layout_width="match_parent" android:layout_height="match_parent"> <TextView android:id="@+id/tag" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_centerHorizontal="true" android:layout_marginTop="5dp" android:fontFamily="sans-serif-black" android:text="Wireless Rehab Device" android:textColor="#676767" android:textSize="24sp" /> </RelativeLayout> </LinearLayout>

Startscreen.java

这是我的public class Startscreen extends AppCompatActivity { private static int SPLASH_DURTION_OUT = 5000; // 5000ms = 5s //Views View first, second, third, fourth, fifth, sixth; TextView bottomTag; ImageView wrd; //Animations Animation topAnimation, bottomAnimation, middelAnimation; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN); setContentView(R.layout.activity_startscreen); topAnimation = AnimationUtils.loadAnimation(this, R.anim.top_animation); bottomAnimation = AnimationUtils.loadAnimation(this, R.anim.bottom_animation); middelAnimation = AnimationUtils.loadAnimation(this, R.anim.middel_animation); first = findViewById(R.id.first_line); second = findViewById(R.id.second_line); third = findViewById(R.id.third_line); fourth = findViewById(R.id.fourth_line); fifth = findViewById(R.id.fifth_line); sixth = findViewById(R.id.six_line); wrd = findViewById(R.id.wrd); bottomTag = findViewById(R.id.tag); //Animation settings first.setAnimation(topAnimation); second.setAnimation(topAnimation); third.setAnimation(topAnimation); fourth.setAnimation(topAnimation); fifth.setAnimation(topAnimation); sixth.setAnimation(topAnimation); wrd.setAnimation(middelAnimation); bottomTag.setAnimation(bottomAnimation); //Splash Screen new Handler().postDelayed(new Runnable() { @Override public void run() { Intent intent = new Intent(Startscreen.this, Home.class); //Home = Mainactivity startActivity(intent); finish(); } }, SPLASH_DURTION_OUT); } }

Manifest

1 个答案:

答案 0 :(得分:1)

发现了问题,我所有的.png图像都在我的Drawable-v24文件夹中,而不是Drawable,所以现在已解决!

相关问题