Android应用程序开发-ProgressBar后面的全屏背景,保持纵横比
新手问题,我正在尝试解决如何在ProgressBar后面有一个全屏背景,并且需要背景图像来保持其纵横比。据我所知,它可能不可能保持与背景图像的纵横比 在activity_main.xml中,我有Android应用程序开发-ProgressBar后面的全屏背景,保持纵横比,android,Android,新手问题,我正在尝试解决如何在ProgressBar后面有一个全屏背景,并且需要背景图像来保持其纵横比。据我所知,它可能不可能保持与背景图像的纵横比 在activity_main.xml中,我有 <ProgressBar android:id="@+id/progressBar1" android:layout_width="match_parent" android:layou
<ProgressBar
android:id="@+id/progressBar1"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_gravity="center"
android:background="@mipmap/splash"
android:indeterminate="false"
android:padding="120dp"
android:textAlignment="center" />
然后在准备就绪时隐藏:
@Override
public void onPageFinished(WebView view, String url) {
//hide loading image
findViewById(R.id.progressBar1).setVisibility(View.GONE);
//show url in webview
findViewById(R.id.web_view).setVisibility(View.VISIBLE);
//Close loading
mySwipeRefreshLayout.setRefreshing(false);
}
});
它做的工作除了背景图像只是拉伸到适合,并不总是看起来很好,因为它失去了它的纵横比
@Override
public void onPageFinished(WebView view, String url) {
//hide loading image
findViewById(R.id.progressBar1).setVisibility(View.GONE);
//show url in webview
findViewById(R.id.web_view).setVisibility(View.VISIBLE);
//Close loading
mySwipeRefreshLayout.setRefreshing(false);
}
});