jul*_*jul 5 android google-maps-android-api-2
我在自定义InfoWindow布局中设置的宽度似乎被忽略(它总是match_parent).
我错过了什么吗?
mMap.setInfoWindowAdapter(new InfoWindowAdapter() {
@Override
public View getInfoWindow(Marker arg0) {
return null;
}
@Override
public View getInfoContents(Marker arg0) {
View v = getActivity().getLayoutInflater().inflate(R.layout.info_window_layout, null);
// set my custom data
return v;
}
});
Run Code Online (Sandbox Code Playgroud)
info_window_layout.xml
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="100dp"
android:layout_height="50dp"
android:padding="5dp" >
<!-- some custom stuff -->
</RelativeLayout>
Run Code Online (Sandbox Code Playgroud)
我想它实际上是wrap_content。
信息窗口的工作方式是将视图绘制到位图上,而不是将其放入任何其他视图组中。layout_xxx 由父 View 使用。
将这些值硬编码到您的RelativeLayout的部分或所有子级上可能会解决您的问题。
| 归档时间: |
|
| 查看次数: |
1809 次 |
| 最近记录: |