如何重新大小片段设置为谷歌地图V2? [英] How to re-size fragment and set to Google Map V2?
本文介绍了如何重新大小片段设置为谷歌地图V2?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想创建的Facebook
如滑块
从以下的 答案 ,在这里我想在运行时更改地图的宽度。
I am trying to create Facebook
like slider
from the following answer, where i want to change map width at a run time.
我试过bindComponent方法里面,但它不是为我工作。
I tried inside bindComponent method , but its not working for me..
<?xml version="1.0" encoding="utf-8"?>
<fragment xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/mapView"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
class="com.google.android.gms.maps.SupportMapFragment" />
活动
public class MapActivity extends FragmentActivity implements
OnClickListener {
private ImageView mSlider;
LinearLayout.LayoutParams mapViewParameters;
GoogleMap gMap;
SupportMapFragment supportMap;
private DisplayMetrics metrics;
@Override
protected void onCreate(Bundle savedInstanceState) {
// TODO Auto-generated method stub
super.onCreate(savedInstanceState);
setContentView(R.layout.slider);
bindComponents();
}
private void bindComponents() {
// TODO Auto-generated method stub
supportMap = (SupportMapFragment) getSupportFragmentManager()
.findFragmentById(R.id.mapView);
metrics = new DisplayMetrics();
mapViewParameters = (LinearLayout.LayoutParams) findViewById(
R.id.mapView).getLayoutParams();
mapViewParameters.width = metrics.widthPixels;
findViewById(R.id.mapView).setLayoutParams(mapViewParameters);
// Map
gMap = supportMap.getMap();
gMap.setMapType(GoogleMap.MAP_TYPE_NORMAL);
mSlider = (ImageView) findViewById(R.id.msliderImage);
}
}
任何帮助将是非常美联社preciated。
Any Help would be highly appreciated.
推荐答案
我会建议你检查这图书馆。我觉得这是我这辈子见过的web像滑动菜单
I would recomend you check this library. I think it's best i ever seen in web for implementing Facebook like Sliding Menu
这篇关于如何重新大小片段设置为谷歌地图V2?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文