想要为新的 Android 版 Google Maps v2 API 设计一个自定义标记气球。我已经覆盖了 getInfoContents 但我现在的布局采用 ym 自定义设计占据了屏幕的整个宽度。我希望它以最大宽度环绕文本。
在线阅读后我发现了我的问题,可能是我在 RelativeLayout 中存在循环依赖,这是不允许的。但是,我将如何将文本字段“位置”移动到布局的右侧,与标题一致但在右侧?
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="wrap_content"
android:layout_height="wrap_content" >
<TextView
android:id="@+id/title"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:ellipsize="end"
android:maxLines="1"
android:paddingBottom="2sp"
android:paddingLeft="5sp"
android:paddingTop="1sp"
android:textColor="@color/list_item_title_color"
android:textSize="15sp"
android:textStyle="bold" />
<TextView
android:id="@+id/text"
android:layout_width="wrap_content"
android:layout_height="wrap_content"sa
android:layout_below="@id/title"
android:ellipsize="end"
android:maxLines="3"
android:paddingBottom="3sp"
android:paddingLeft="5sp"
android:paddingRight="5sp"
android:textColor="@color/list_item_text_color"
android:textSize="13sp" />
<TextView
android:id="@+id/place"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:gravity="right"
android:paddingRight="5sp"
android:paddingTop="1sp"
android:textColor="@color/list_item_date_color"
android:textSize="13sp" />
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/icons"
android:layout_width="fill_parent"
android:layout_height="32dp"
android:layout_below="@id/place"
android:gravity="right"
android:orientation="vertical"
android:paddingBottom="2sp"
android:paddingLeft="5sp"
android:paddingRight="5sp" >
</LinearLayout>
</RelativeLayout>