在启动屏幕上显示带有进度条的bg图像

问题描述 投票:0回答:1

我正在尝试在初始屏幕上显示BG图像和进度栏。

splash.xml的代码

<?xml version="1.0" encoding="utf-8"?>
<FrameLayout android:layout_height="match_parent" android:layout_width="match_parent"
    xmlns:android="http://schemas.android.com/apk/res/android" android:background="@drawable/spalsh">
        <ProgressBar
            android:id="@+id/loading"
            style="?android:progressBarStyleLarge"
            android:layout_width="wrap_content"
            android:indeterminateDrawable="@layout/progressbartemplate"
            android:layout_height="wrap_content"
            android:layout_gravity="bottom|center"
            android:layout_marginBottom="10dp" />
</FrameLayout>

然后按我的风格

<style name="SplashTheme" parent="Theme.AppCompat.Light.NoActionBar">
        <item name="android:background" >@layout/splash</item>
    </style>

然后我将此样式应用于manifiedstfile中的Activity

<activity
            android:name="com.test.SplashActivity" android:theme="@style/SplashTheme"
            android:label="@string/app_name">
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />
                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>

但是当应用启动时,我看不到图像和进度条,而在设计视图中却可以看到它们。如果我使用“层列表”并删除进度条,则相同的代码将起作用。

有人可以建议我如何显示进度条在底部的bg图像吗?

提前感谢

android android-layout android-activity splash-screen android-theme
1个回答
0
投票

尝试一下,希望这可以解决您的问题。

© www.soinside.com 2019 - 2024. All rights reserved.