试图在支持地图片段上编辑Edittext

时间:2018-05-05 07:37:54

标签: java android

您好我正在开发一个使用支持ma片段的应用,但是当我尝试将edittext与textview一起放在地图上时,地图上没有显示任何内容,我的意思是textview和editext不可见在地图上我现在不知道我哪里出错所以如果有人可以在这里帮助我,请 这是我的xml

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:map="http://schemas.android.com/apk/res-auto"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    android:fitsSystemWindows="true">
<LinearLayout
    android:layout_above="@+id/viewpagerTop"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:orientation="vertical"
    android:layout_alignParentTop="true"
    android:layout_marginTop="15dp"
    >
    <com.ct.listrtrial.Custom.CustomTextViewMedium
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="Nearby"
        android:textSize="24sp"
        android:textColor="@color/White"
        android:layout_marginLeft="10dp"
        android:layout_marginBottom="5dp"/>
<EditText
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:drawableLeft="@drawable/ic_search_black_24dp"
    android:background="@drawable/edit_text_shape"
    android:layout_marginLeft="20dp"
    android:layout_marginRight="20dp"/>
</LinearLayout>
    <fragment
        android:id="@+id/Maps"
        class="com.google.android.gms.maps.SupportMapFragment"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        map:cameraTilt="30"
        map:mapType="normal"
        map:uiCompass="true"
        map:uiRotateGestures="true"
        map:uiScrollGestures="true"
        map:uiTiltGestures="true"
        map:uiZoomControls="false"
        map:uiZoomGestures="true" />

    <android.support.v4.view.ViewPager
        android:id="@+id/viewPagerbackground"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_gravity="center"
        android:visibility="gone"/>

    <View
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:background="#B07986CB"
        android:visibility="gone"/>

    <android.support.v4.view.ViewPager
        android:id="@+id/viewpagerTop"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:clipToPadding="false"
        android:paddingLeft="50dp"
        android:paddingRight="50dp"
        android:layout_marginTop="190dp"
        android:paddingBottom="10dp"
        android:layout_alignParentBottom="true" />
</RelativeLayout>

2 个答案:

答案 0 :(得分:1)

尝试使用FrameLayout代替主RelativeLayout,并将LinearLayout与ID viewpagerTop重叠,将其保持在Fragment

之下

答案 1 :(得分:1)

您可以尝试以下格式吗?

<fragment
    android:id="@+id/Maps"
    ............ />

<LinearLayout
    .............>
   <CustomTextView
       .......... />
   <TextView
       .......... />

</LinearLayout>

其他观点