Android 与MapView处于相同相对布局的进度条:除非MapView可见,否则不可见
这就是问题所在Android 与MapView处于相同相对布局的进度条:除非MapView可见,否则不可见,android,google-maps,Android,Google Maps,这就是问题所在 <?xml version="1.0" encoding="utf-8"?> <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" android:orientation="vertical" android:layout_width="match_parent" andr
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:theme="@style/TransparentBar"
android:fitsSystemWindows="true"
>
<com.google.android.gms.maps.MapView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:id="@+id/fullscreen_map"
android:visibility="invisible"
/>
<ProgressBar
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerInParent="true"
android:visibility="visible"
android:id="@+id/spinnerprogress"
/>
</RelativeLayout>
基本上就是这样
视图初始化:
@Override
public void onCreate(Bundle b) {
super.onCreate(b);
setContentView(R.layout.fullscreen_map);
//This is workaround to show at least anything to user while data is being loaded.
pd = new ProgressDialog(this);
pd.setProgressStyle(ProgressDialog.STYLE_SPINNER);
//However, loading spinner inside the ProgressDialog is invisible as well unless MapView is showing.
pd.setTitle(R.string.map_is_loading);
pd.show();
pd.setCancelable(false);
progressBar = (ProgressBar) findViewById(R.id.spinnerprogress);
mv = (MapView) findViewById(R.id.fullscreen_map);
mv.getMapAsync(this); //data will be loaded after getMapAsync()
mv.onCreate(b);
buildingLocation = new LatLng(
getIntent().getExtras().getDouble("building_lat"),
getIntent().getExtras().getDouble("building_lng")
);
polyline = getIntent().getExtras().getString("polyline");
name = getIntent().getExtras().getString("building_name");
address = getIntent().getExtras().getString("building_addr");
getSupportActionBar().setTitle(name);
getSupportActionBar().setDisplayShowHomeEnabled(true);
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
}
主题:
<style name="TransparentBar" parent="AppTheme">
<item name="android:windowTranslucentStatus">true</item>
<item name="android:windowTranslucentNavigation">true</item>
</style>
<style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar">
<item name="colorPrimary">#ba864c</item>
<item name="colorPrimaryDark">@color/status_bar_color</item>
<item name="colorAccent">@color/colorAccent</item>
<item name="android:colorBackground">@color/app_general_background</item>
<item name="android:actionOverflowButtonStyle">@style/ActionButtonThing</item>
<item name="android:colorControlNormal">@color/pink_app_color</item>
</style>
真的
真的
#ba864c
@颜色/状态\u栏\u颜色
@颜色/颜色重音
@颜色/应用程序\u常规\u背景
@样式/动作按钮
@颜色/粉色应用程序颜色
您的进度条是否可能与背景颜色相同,但您看不到它?另外,发布你所有的setVisibility
code.nope,它的颜色和背景不一样。还用setVisibiles更新了帖子。没有看到任何错误。你能在初始化视图的地方发布你的代码吗?也许可以尝试visibility=“gone”
而不是visibility=“invisible”
,在这种情况下也是一样的,@Panczur。
<style name="TransparentBar" parent="AppTheme">
<item name="android:windowTranslucentStatus">true</item>
<item name="android:windowTranslucentNavigation">true</item>
</style>
<style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar">
<item name="colorPrimary">#ba864c</item>
<item name="colorPrimaryDark">@color/status_bar_color</item>
<item name="colorAccent">@color/colorAccent</item>
<item name="android:colorBackground">@color/app_general_background</item>
<item name="android:actionOverflowButtonStyle">@style/ActionButtonThing</item>
<item name="android:colorControlNormal">@color/pink_app_color</item>
</style>