Programming/Android

[Android] Fragment Width(넓이)

Fimtrus 2014. 2. 6. 18:09
mRootLayout.getViewTreeObserver().addOnGlobalLayoutListener(new ViewTreeObserver.OnGlobalLayoutListener() {
	@Override
	public void onGlobalLayout() {
		mFragmentWidth = getView().getWidth();
		mFragmentHeight = getView().getHeight();
		if (mFragmentWidth > 0) {
			ViewGroup.LayoutParams params = new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, mFragmentWidth);
			mMapView.setLayoutParams(params);
		}
	}
});