Добрый день всем, у меня есть линейный макет, который выглядит, как этотандроида расположение XML, чтобы соответствовать любой экран (линейный или относительный)
в области фрагмента есть фрагмент на карте Google , то, что я хочу, это иметь макет, который заставит фрагмент использовать доступное пространство на экране, не покидая остальных элементов, вытесненных, поэтому на некоторых экранах карта будет выше, чем в других, макет, который у меня есть теперь, используя фиксированный layout_height для карты, то, что я хотел быть какой-то динамичной, поэтому я могу удалить тег scrollview
это мой текущий xml
<?xml version="1.0" encoding="utf-8"?>
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context="xxxxxxxxx">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<include layout="@layout/toolbar_default" />
<LinearLayout
android:id="@+id/xxxxxxx"
android:visibility="visible"
android:layout_width="match_parent"
android:paddingTop="8dp"
android:paddingBottom="8dp"
android:background="@color/app_blue_dark"
android:layout_height="wrap_content"
android:gravity="center"
android:orientation="horizontal">
<TextView
android:id="@+id/xxxxxxx"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textStyle="bold"
android:gravity="center"
android:textColor="@color/solid_white"
android:drawableLeft="@drawable/xxxxxxxx"
android:text="xxxxxxxxx" />
</LinearLayout>
<LinearLayout
android:layout_margin="@dimen/activity_vertical_margin"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<android.support.v7.widget.SwitchCompat
android:id="@+id/xxxxxxxx"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:textColor="#666"
android:text="@string/xxxxxxx"/>
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center"
android:weightSum="100"
android:orientation="horizontal">
<android.support.v7.widget.AppCompatButton
android:id="@+id/xxxxxxxx"
android:textColor="@color/solid_white"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:onClick="xxxxxxxxx"
android:layout_marginLeft="@dimen/activity_vertical_margin"
android:text="@string/xxxxxxxx"
android:layout_weight="50"
android:drawableLeft="@drawable/xxxxxxxxxx" />
<android.support.v7.widget.AppCompatButton
android:id="@+id/xxxxxxxxx"
android:drawablePadding="0dp"
android:textColor="@color/solid_white"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/xxxxxxxx"
android:onClick="xxxxxxxxx"
android:layout_marginRight="@dimen/activity_vertical_margin"
android:layout_weight="50"
android:drawableLeft="@drawable/xxxxxxx" />
</LinearLayout>
<RelativeLayout
android:id="@+id/xxxxxxx"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin"
android:paddingBottom="0dp"
android:layout_margin="0dp"
android:paddingTop="@dimen/activity_vertical_margin">
<TextView
android:id="@+id/xxxxxxx"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="xxxxxxxx"
android:layout_marginTop="@dimen/activity_vertical_margin" />
<android.support.v7.widget.AppCompatImageButton
android:id="@+id/xxx"
android:layout_alignParentRight="true"
android:layout_width="wrap_content"
android:onClick="xxxxxxxx"
android:layout_height="wrap_content"
android:src="@drawable/xxxxxxxxx" />
</RelativeLayout>
<fragment
android:id="@+id/map"
android:layout_marginTop="@dimen/activity_vertical_margin"
android:name="com.google.android.gms.maps.SupportMapFragment"
android:layout_width="match_parent"
android:layout_height="275dp" />
<LinearLayout
android:id="@+id/xxxx"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:padding="@dimen/activity_vertical_margin">
<TextView
android:textStyle="bold"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="xxxxxx" />
<TextView
android:id="@+id/xxxx"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="xxxxxxxxxxxxxx"
android:lines="2" />
</LinearLayout>
</LinearLayout>
</ScrollView>
спасибо за помощь!
спасибо за ответ, где я должен использовать свойство? в фрагменте карты ?, потому что, если бы я это сделал, он сделал карту всегда маленькой и того же размера, независимо от того, на каком экране находится, похоже на использование minHeight по умолчанию, но не делает то, что я хочу – goseta
Да, в фрагменте карты : '<фрагмент android: id =" @ + id/map " android: layout_marginTop =" @ dimen/activity_vertical_margin " android: layout_weight =" 1 "android: name =" com.google.android.gms.maps. SupportMapFragment " android: layout_width =" match_parent " android: layout_height =" 0dp "/>'. Это не сделает карту всегда маленькой, у нее будет столько места, сколько осталось после того, как другие представления отобразятся на экране. Не могли бы вы попробовать? :) – MadaT
Да, мой плохой, первый раз не сработал, сейчас работает отлично, спасибо за вашу помощь – goseta