[m1]
[1.0.2] [车模、地图定位]
This commit is contained in:
@@ -66,6 +66,8 @@ class OverMapView @JvmOverloads constructor(
|
||||
private var arrivedDrawable: Int = -1
|
||||
private var unArrivedDrawable: Int = -1
|
||||
private var resetDrawable: Int = -1
|
||||
private var resetDrawableMarginRight: Int = -1
|
||||
private var resetDrawableMarginBottom: Int = -1
|
||||
|
||||
private var mMapView: TextureMapView? = null
|
||||
private var mAMap: AMap? = null
|
||||
@@ -121,6 +123,8 @@ class OverMapView @JvmOverloads constructor(
|
||||
unArrivedDrawable =
|
||||
typedArray.getResourceId(R.styleable.OverMapView_unArrivedDrawable, -1)
|
||||
resetDrawable = typedArray.getResourceId(R.styleable.OverMapView_resetDrawable, -1)
|
||||
resetDrawableMarginRight = typedArray.getResourceId(R.styleable.OverMapView_resetDrawableMarginRight, AutoSizeUtils.dp2px(context,40f))
|
||||
resetDrawableMarginBottom = typedArray.getResourceId(R.styleable.OverMapView_resetDrawableMarginBottom, AutoSizeUtils.dp2px(context,40f))
|
||||
typedArray.recycle()
|
||||
initView(context)
|
||||
} catch (e: Exception) {
|
||||
@@ -215,8 +219,16 @@ class OverMapView @JvmOverloads constructor(
|
||||
val smpView = LayoutInflater.from(context).inflate(R.layout.module_overview_map_view, this)
|
||||
mMapView = smpView.findViewById(R.id.aMapView)
|
||||
overLayerView = findViewById(R.id.overLayer)
|
||||
overLayerView?.background =
|
||||
resources.getDrawable(if (resetDrawable != -1) resetDrawable else R.drawable.amap_reset)
|
||||
overLayerView?.let {
|
||||
it.background =
|
||||
resources.getDrawable(if (resetDrawable != -1) resetDrawable else R.drawable.amap_reset)
|
||||
val layoutParams = it.layoutParams
|
||||
layoutParams as RelativeLayout.LayoutParams
|
||||
layoutParams.rightMargin =resetDrawableMarginRight
|
||||
layoutParams.bottomMargin =resetDrawableMarginBottom
|
||||
it.layoutParams = layoutParams
|
||||
}
|
||||
|
||||
arrivedBitmap =
|
||||
BitmapDescriptorFactory.fromResource(if (arrivedDrawable != -1) arrivedDrawable else R.drawable.taxi_map_arrow_arrived)
|
||||
unArrivedBitmap =
|
||||
|
||||
@@ -25,8 +25,8 @@
|
||||
|
||||
<TextView
|
||||
android:id="@+id/overLayer"
|
||||
android:layout_width="@dimen/dp_116"
|
||||
android:layout_height="@dimen/dp_116"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:scaleType="centerInside"
|
||||
android:layout_alignParentRight="true"
|
||||
android:layout_alignParentBottom="true"
|
||||
|
||||
@@ -18,5 +18,9 @@
|
||||
<attr name="unArrivedDrawable" format="reference" />
|
||||
<!-- 重置位置图片 -->
|
||||
<attr name="resetDrawable" format="reference" />
|
||||
<!-- 重置位置图片右面margin -->
|
||||
<attr name="resetDrawableMarginRight" format="dimension" />
|
||||
<!-- 重置位置图片下面margin -->
|
||||
<attr name="resetDrawableMarginBottom" format="dimension" />
|
||||
</declare-styleable>
|
||||
</resources>
|
||||
Reference in New Issue
Block a user