在Android 9设备(天堂OS 16)上运行该应用程序时,它可以正常运行。但是,当我尝试在Nougat或Oreo等设备上打开它时,它只会显示空白的白色活动。 (注意:在Android 9(世系OS)中,我只得到了1或2秒的白色空白屏幕,但是在Nougat和Oreo中,它卡在了空白白色屏幕上。我尝试启动其他活动,如启动器活动和其他活动一样,但应将MainActivity类启动,以使其他活动正常工作。我不知道该错误是在布局设计中还是在Java类中(我认为该错误可能不在Java类中,因为该应用程序可在Android 9设备上完美运行!!)。在这里,我提供了xml布局和Java类。
activity_main.xml
<?xml version="1.0" encoding="utf-8"?>
<android.support.v4.widget.DrawerLayout
android:id="@+id/drawer_layout"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto">
<RelativeLayout
android:layout_width="fill_parent"
android:layout_height="fill_parent">
<LinearLayout
android:id="@+id/ll_ads"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:orientation="horizontal" />
<RelativeLayout
android:id="@+id/track_info"
android:background="#ff0000"
android:visibility="gone"
android:layout_width="fill_parent"
android:layout_height="@dimen/track_info_layout_height"
android:layout_above="@+id/ll_ads">
<LinearLayout
android:background="@color/bottom_control_background"
android:layout_width="fill_parent"
android:layout_height="fill_parent">
<com.makeramen.roundedimageview.RoundedImageView
android:layout_gravity="center_vertical"
android:id="@+id/artwork_min"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="4.0dip"
android:src="@drawable/default_artwork"
android:scaleType="fitXY"
android:contentDescription="@string/album_artwork" />
<RelativeLayout
android:padding="@dimen/content_padding"
android:layout_width="0.0dip"
android:layout_height="fill_parent"
android:layout_weight="1.0">
<TextView
android:textSize="16.0sp"
android:textStyle="bold"
android:textColor="#ffffff"
android:ellipsize="end"
android:id="@+id/song_title"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:singleLine="true"
android:layout_alignParentTop="true" />
<TextView
android:textSize="14.0sp"
android:textColor="#ffffff"
android:ellipsize="end"
android:id="@+id/song_artist"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_marginTop="4.0dip"
android:singleLine="true"
android:layout_below="@+id/song_title" />
</RelativeLayout>
<LinearLayout
android:id="@+id/quick_controls"
android:layout_width="wrap_content"
android:layout_height="fill_parent">
<ImageButton
android:id="@+id/quick_prev"
android:background="?selectableItemBackgroundBorderless"
android:layout_width="wrap_content"
android:layout_height="fill_parent"
android:src="@drawable/btn_prev"
android:scaleType="center"
android:contentDescription="@string/prev" />
<ImageButton
android:id="@+id/quick_play_pause_toggle"
android:background="?selectableItemBackgroundBorderless"
android:layout_width="wrap_content"
android:layout_height="fill_parent"
android:src="@drawable/btn_play"
android:scaleType="center"
android:contentDescription="@string/play" />
<ImageButton
android:id="@+id/quick_next"
android:background="?selectableItemBackgroundBorderless"
android:layout_width="wrap_content"
android:layout_height="fill_parent"
android:src="@drawable/btn_next"
android:scaleType="center"
android:contentDescription="@string/next" />
</LinearLayout>
</LinearLayout>
<com.musicplayer.players9.musicsamsung.free2018.widgets.ProgressBar
android:id="@+id/progress_bar"
android:padding="0.0dip"
android:layout_width="fill_parent"
android:layout_height="2.0dip"
android:layout_alignParentTop="true"
app:progressColor="?colorAccent" />
</RelativeLayout>
<FrameLayout
android:id="@+id/container"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_above="@+id/track_info" />
</RelativeLayout>
<android.support.design.widget.NavigationView
android:layout_gravity="start"
android:id="@+id/navigation_view"
android:layout_width="wrap_content"
android:layout_height="fill_parent"
app:menu="@menu/navigation" />
</android.support.v4.widget.DrawerLayout>
Java类 Lint to Java Class
答案 0 :(得分:1)
不可能...我不是在写它作为答案;我将在他阅读后将其删除。 但是,如果逐行接着进行相同的更改,它也会得到解决
停止对
mainsctivity
中的数千行进行编码
不是所有代码,逻辑和操作都在这里... !!
那么什么是mainActivity?
据我所知,仅100行代码
这100行代码应该做什么?
检查android版本,如果在棉花糖上方,请问下面的权限什么都不做。并在主线程上启动服务,或在其他线程上启动用于操作和任务的.. !!
那。它。
我知道这不是答案...,我知道这也不应该是错误