У меня есть активность со следующим макетом:
<?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>
Я хочу иметь возможность скрыть / показать отдельный LinearLayout с идентификатором 'view', а затем позволить MapView изменить размер в соответствии с оставшимся пространством. Когда я пытаюсь это сделать, отдельный LinearLayout никогда не отображается. Я не уверен, что происходит! LinearLayout навсегда скрыт? это позади 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);
}