Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/visual-studio-code/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Android 布局未根据需要正确显示_Android_Android Layout_Layout - Fatal编程技术网

Android 布局未根据需要正确显示

Android 布局未根据需要正确显示,android,android-layout,layout,Android,Android Layout,Layout,请参阅附加的屏幕截图,我正在使用谷歌地图2版显示图像弹出窗口 我在弹出窗口中查找三个小更改,它们是: 想要在完整的背景上显示图像,就像我的图像只覆盖50%的标记区域一样 也要覆盖白色区域的标记白色的角落 如果我想在拐角处显示黑色阴影呢 popup.xml:- 我想我必须使用更宽的图像作为标记的背景,我担心这些白色的角落,我不想看到它更改RelativeLayout和ImageView中的四个包裹内容以匹配父对象。 然而,图像视图可能看起来是拉伸的,因此你应该考虑使用更宽的图像。 < P>用这个变

请参阅附加的屏幕截图,我正在使用谷歌地图2版显示图像弹出窗口

我在弹出窗口中查找三个小更改,它们是:

想要在完整的背景上显示图像,就像我的图像只覆盖50%的标记区域一样

也要覆盖白色区域的标记白色的角落

如果我想在拐角处显示黑色阴影呢

popup.xml:-


我想我必须使用更宽的图像作为标记的背景,我担心这些白色的角落,我不想看到它

更改RelativeLayout和ImageView中的四个包裹内容以匹配父对象。 然而,图像视图可能看起来是拉伸的,因此你应该考虑使用更宽的图像。

< P>用这个变化内容替换图像视图到匹配的父< /P> …rest xml代码

尝试这种方法,希望这将帮助您解决问题

     <ImageView
        android:id="@+id/icon"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:src="@drawable/ic_launcher"
        android:background="@null"
        android:scaleType="fitxy"
        android:contentDescription="@string/icon"/>

使用ImageView的match_parent,它会显示图像位于中心的全宽标记,这是完全错误的,并且不是错误的required@Sonali您是否尝试过这个,当您应用它时会发生什么?@Sonali,好的,那么请尝试定义此布局的id,并在运行时设置背景图像。
 <ImageView
    android:id="@+id/icon"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:src="@drawable/ic_launcher"
    android:background="@null"
    android:contentDescription="@string/icon"/> 
     <ImageView
        android:id="@+id/icon"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:src="@drawable/ic_launcher"
        android:background="@null"
        android:scaleType="fitxy"
        android:contentDescription="@string/icon"/>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:gravity="center"
    android:background="@drawable/background"> // Here set your custom pop window background with with and black shadow

    <LinearLayout
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:orientation="vertical"
        android:background="@drawable/ic_launcher"> // Here set your place image
        <TextView
            android:id="@+id/title"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:maxLines="1"
            android:textColor="@android:color/background_light"
            android:layout_marginTop="5dp"
            android:textSize="18sp"
            android:typeface="sans"
            android:text="Great Hotel - A Luxury Sun"
            android:textStyle="bold"/>

        <TextView
            android:id="@+id/snippet"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:typeface="sans"
            android:textStyle="bold"
            android:textSize="18sp"
            android:maxLines="1"
            android:layout_marginTop="10dp"
            android:text="$359"
            android:textColor="@android:color/background_light" />
    </LinearLayout>

</LinearLayout>