[英]Android Resize MapView after Visibility change
I've got an activity with the following layout: 我有一个具有以下布局的活动:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical">
<com.google.android.maps.MapView
android:id="@+id/map"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
<LinearLayout
android:id="@+id/view"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:gravity="center"
android:padding="5dp" >
<TextView
android:id="@+id/text"
android:layout_width="wrap_content"
android:layout_height="fill_parent"
android:textColor="#FFF"
android:padding="5dp" />
</LinearLayout>
</LinearLayout>
I want to be able to hide/show the seperate LinearLayout with id 'view' and then let the MapView resize according to the space left. 我希望能够隐藏/显示ID为“ view”的单独LinearLayout,然后让MapView根据剩余空间调整大小。 When I try this the seperate LinearLayout is never shown.
当我尝试此操作时,永远不会显示单独的LinearLayout。 I'm not sure what is going on!
我不确定发生了什么! Is the LinearLayout forever hidden?
永远不会隐藏LinearLayout吗? is it behind the Mapview?
它在Mapview后面吗?
private void showMessage() {
LinearLayout layout = (LinearLayout) findViewById(R.id.view);
layout.setVisibility(View.VISIBLE);
}
private void hideMessage() {
LinearLayout layout = (LinearLayout) findViewById(R.id.view);
layout.setVisibility(View.GONE);
}
问题似乎可以通过更改XML布局文件中的初始化顺序来解决,并且在以后的Android版本中可能不会发生。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.