What i want is, when i click on Dashboard Button it will open like a SlidingDrawer and after it opened when clicked on it again it will close. i use this custom drawer becau
Here's how i got solution for this problem.
the actual problem with getting layout's height when we set it to wrap content is, it will not give height until it will actually draw on a screen. and in my case the custom layout got called first and then it will call remaining layout, so there is not a chance for layout to get draw.
so what i did is i got actual height and width of the screen run time by using following code.
DisplayMetrics metrics = new DisplayMetrics();
((WindowManager) context.getSystemService(Context.WINDOW_SERVICE)).getDefaultDisplay().getMetrics(metrics);
height = metrics.heightPixels;
width = metrics.widthPixels;
and after i got screens height and width, inflate view. after that got linearlayouts height and add new height to it using following code.
RelativeLayout.LayoutParams params = (RelativeLayout.LayoutParams) relLayTwo.getLayoutParams();
Log.d("test", "height "+params.height);
params.height = height*40/100;
relLayTwo.setLayoutParams(params);
relLayTwo.setVisibility(View.GONE);
and its worked!!