我正在创建一个活动 - 它有一个平面图上的销钉,其中的东西在平面图上找到。缩放家长但不是儿童的意见
下面是活动的布局:
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:windowSoftInputMode="stateHidden"
android:focusable="true"
android:focusableInTouchMode="true"
android:id="@+id/layout">
<requestFocus />
</RelativeLayout>
我设置的RelativeLayout的背景图像的平面图。
private RelativeLayout _layout;
_layout = (RelativeLayout)findViewById(R.id.layout);
_layout.setBackground(new BitmapDrawable(getResources(), map));
我动态地在地图上的各个位置放置引脚(与我的apk文件打包的png drawable)。我随时创建一个相关布局 - 然后在相关布局中添加一个imageview(使用png文件),然后添加一个TextView(像引脚内有一个数字的gps引脚)。
RelativeLayout grouping = new RelativeLayout(this);
Bitmap img = BitmapFactory.decodeResource(getResources(), R.drawable.symbol);
ImageView symbol = new ImageView(this);
symbol.setImageBitmap(img);
RelativeLayout.LayoutParams params = new RelativeLayout.LayoutParams(RelativeLayout.LayoutParams.WRAP_CONTENT, RelativeLayout.LayoutParams.WRAP_CONTENT);
grouping.addView(symbol);
TextView mapNum = new TextView(this);
grouping.addView(mapNum, params);
_layout.addView(grouping, params);
所有这一切都很好。
所以在活动中,我还提供放大平面图的能力。
_layout.setScaleX(_scaling);
_layout.setScaleY(_scaling);
一旦放大,我允许用户在平面图上移动。这也很好。当你在平面图中移动时,gps引脚仍然保持在他们应该在的位置(都很好)。
我遇到的问题是当我放大布局 - 引脚也缩放。我希望楼层地图上的GPS引脚保持原有尺寸。
任何指针如何缩放父,但不缩放子视图?