android - How to create layout withminimum and maximum height? -


I have two layout layouts 1 and layout 2 in linear layout with vertical gravity. For me, the height example of standard layout1 is 300dp (big height for small display)

In small display, it takes almost all the visual height but I want to see layout maximum height 50%.

If I set 50% of all height views of the height in the larger display, then I have some damage.
Enter image details here
If I set a 300dp height in a smaller display then my The close layout is 1.
Enter the image details here
So I want the height of layout 1, for the load in small displays In the 50% and large display, the DPI will have to limit 300dp.
How can I set this limit in my layout 1 On the runtime, you can determine how much your linear layout is taking 1, and adjust its height only when it is done. To do more than half the screen, use the following code.

Suppose you RID your linear layout 1. LL1, then using this code, you can tell Android to adjust the height of the LLU by 50%

  Full screen light, screenwidth; // Code to determine the height and width of the screen. Display display = getWindowManager.getDefaultDisplay (); If (android.os.build.Version.SDK_INT> = 13) {point size = new point (); Display.getSize (size); ScreenHight = Size. X; Screenview = Size. Y; } Else {screenWidth = display.getWidth (); Screenhigh = display.getHeight (); } LinearLayout ll = (LinearLayout) findViewById (R.id.LL1); Int layoutshell = ll.getLayoutParams (). Height; // is the height of the layout (if the layout heat * 2) & gt; Screenhit) {// When more than half of the screen is seen in LL1, it is a good time to set it back to 50% height. Layautom (). Height = screenHeight / 2; Ll.requestLayout (); // force layout to be adjusted} Else {// All good, no work is needed, so leave this block}  

Comments

Popular posts from this blog

import - Python ImportError: No module named wmi -

Editing Python Class in Shell and SQLAlchemy -

c# - MySQL Parameterized Select Query joining tables issue -