Макеты не видны, несмотря на то, что представления установлены на VIEW.VISIBLE - PullRequest
0 голосов
/ 10 мая 2019

У меня есть рабочий фрагмент карты с рабочим блоком навигации. 2 линейных макета не видны, несмотря на то, что они установлены в видимом в xml. Вид помогите мне. Что бы скрывать эти макеты?чтобы они работали.

Я попробовал несколько решений в сети, но ни одно из них не помогло мне.

<FrameLayout 
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/main"
android:layout_width="match_parent"
android:layout_height="match_parent">

<LinearLayout
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:gravity="top"
    android:orientation="vertical"
    android:padding="5dp"
    android:weightSum="0">

    <Button
        android:id="@+id/CanelRide"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:text="Cancel Ride"
        android:visibility="visible" />
</LinearLayout>

<LinearLayout
    android:id="@+id/customerInfo"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:layout_gravity="bottom"
    android:background="@color/white"
    android:orientation="horizontal"
    android:padding="10dp"
    android:visibility="visible">

    <ImageView
        android:id="@+id/customerProfileImage"
        android:layout_width="100dp"
        android:layout_height="100dp"
        android:layout_margin="5dp"
        android:padding="20sp"
        android:src="@drawable/mainicon" />

    <TextView
        android:id="@+id/customerName"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_margin="3dp"
        android:layout_marginTop="2dp"
        android:gravity="left"
        android:paddingBottom="3dp"
        android:paddingLeft="5dp"
        android:paddingRight="3dp"
        android:text="Both Names"
        android:textColor="@color/black"
        android:textSize="19dp" />

</LinearLayout>

<android.support.v4.widget.DrawerLayout
    android:id="@+id/drawer_layout"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:fitsSystemWindows="true"
    tools:openDrawer="start">

    <android.support.design.widget.NavigationView
        android:id="@+id/nav_view"
        android:layout_width="wrap_content"
        android:layout_height="match_parent"
        android:layout_gravity="start"
        android:fitsSystemWindows="true"
        app:headerLayout="@layout/driver_nav_header"
        app:menu="@menu/driver_menu">

    </android.support.design.widget.NavigationView>

    <android.support.design.widget.AppBarLayout
        android:id="@+id/appBarLayout"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:background="@color/black">

        <fragment
            android:id="@+id/map"
            android:name="com.google.android.gms.maps.SupportMapFragment"
            android:layout_width="match_parent"
            android:layout_height="match_parent"/>


    </android.support.design.widget.AppBarLayout>
</android.support.v4.widget.DrawerLayout>

1 Ответ

0 голосов
/ 10 мая 2019

Попробуйте использовать приведенный ниже макет, я изменил макет фрейма как дочерний, а макет ящика как родительский

<android.support.v4.widget.DrawerLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/drawer_layout"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fitsSystemWindows="true"
tools:openDrawer="start">
  <FrameLayout
   android:id="@+id/main"
   android:layout_width="match_parent"
   android:layout_height="match_parent">
            <fragment
        android:id="@+id/map"
        android:name="com.google.android.gms.maps.SupportMapFragment"
        android:layout_width="match_parent"
        android:layout_height="match_parent"/>
<LinearLayout
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:gravity="top"
    android:orientation="vertical"
    android:padding="5dp"
    android:weightSum="0">

    <Button
        android:id="@+id/CanelRide"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:text="Cancel Ride"
        android:visibility="visible" />
</LinearLayout>
<LinearLayout
    android:id="@+id/customerInfo"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:layout_gravity="bottom"
    android:background="@color/white"
    android:orientation="horizontal"
    android:padding="10dp"
    android:visibility="visible">
    <ImageView
        android:id="@+id/customerProfileImage"
        android:layout_width="100dp"
        android:layout_height="100dp"
        android:layout_margin="5dp"
        android:padding="20sp"
        android:src="@drawable/mainicon" />
    <TextView
        android:id="@+id/customerName"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_margin="3dp"
        android:layout_marginTop="2dp"
        android:gravity="left"
        android:paddingBottom="3dp"
        android:paddingLeft="5dp"
        android:paddingRight="3dp"
        android:text="Both Names"
        android:textColor="@color/black"
        android:textSize="19dp" />
</LinearLayout>
    <android.support.design.widget.NavigationView
        android:id="@+id/nav_view"
        android:layout_width="wrap_content"
        android:layout_height="match_parent"
        android:layout_gravity="start"
        android:fitsSystemWindows="true"
        app:headerLayout="@layout/driver_nav_header"
        app:menu="@menu/driver_menu"/>
    <android.support.design.widget.AppBarLayout
        android:id="@+id/appBarLayout"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:background="@color/black"/>                            
 </FrameLayout>
</android.support.v4.widget.DrawerLayout>
...