Click here to Skip to main content
16,019,273 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
Hi, I am Using Xamarin android I tried to create the Design by using Layout. it has worked in Large Size Displays for ex above the 5.5-inch size of Mobile my Design comes as an actual one. but less than 5.5 inches it got collapsed I have attached the Code that I have tried. Can you please suggest how can I resolve this...

What I have tried:

<?xml version="1.0" encoding="utf-8"?>

<ScrollView
    xmlns:android="http://schemas.android.com/apk/res/android"
    android:id="@+id/scroll"
    android:layout_width="match_parent"
    android:layout_height="wrap_content">

    <LinearLayout
        xmlns:android="http://schemas.android.com/apk/res/android"
        android:orientation="vertical"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:scrollbars="vertical"
        android:paddingTop="200px">


        <LinearLayout
            android:layout_width="match_parent"
            android:layout_height="500px"
            android:orientation="horizontal"
            android:layout_marginTop="10px">
            <FrameLayout
                android:layout_width="360px"
                android:layout_height="500px"
                android:id="@+id/frameLayout1"
                android:background="?attr/colorPrimary">
                <ImageView
                    android:id="@+id/EURUSD"
                    android:layout_width="match_parent"
                    android:layout_height="300px"
                    android:src="@drawable/eurusd"
                    android:layout_gravity="center_vertical"
                    android:foregroundGravity="center_vertical"
        />
                <!--<TextView
                android:text="EURUSD"
                android:textAppearance="?android:attr/textAppearanceLarge"
                android:layout_width="match_parent"
                android:layout_height="match_parent"
                android:id="@+id/EURUSD"
                android:gravity="center"
                android:textStyle="bold"/>-->

            </FrameLayout>
            <FrameLayout
                android:layout_width="700px"
                android:layout_height="500px"
                android:id="@+id/frameLayout2"
                android:layout_marginLeft="10px"
                android:background="?attr/colorPrimary">

                <TextView
                    android:text="Signal:"
                    android:textStyle="bold"
                    android:textColor="@android:color/white"
                    android:padding="70px"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"/>
                <TextView
                    android:text="Waiting"
                    android:textStyle="bold"
                    android:padding="40px"
                    android:textSize="80px"
                    android:textColor="@android:color/white"
                    android:layout_marginLeft="260px"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:id="@+id/EURUSDSIGNAL"/>

                <TextView
                    android:text="TP@:"
                    android:textStyle="bold"
                    android:textColor="@android:color/white"
                    android:padding="70px"
                    android:textSize="80px"
                    android:layout_marginTop="100px"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"/>
                <TextView
                    android:text=""
                    android:textStyle="bold"
                    android:padding="40px"
                    android:textSize="80px"
                    android:textColor="@android:color/white"
                    android:layout_marginLeft="260px"
                    android:layout_marginTop="130px"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:id="@+id/EURUSDTP"/>
                <TextView
                    android:text="SL@:"
                    android:textStyle="bold"
                    android:textColor="@android:color/white"
                    android:padding="70px"
                    android:textSize="80px"
                    android:layout_marginTop="220px"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"/>

                <TextView
                    android:text=""
                    android:textStyle="bold"
                    android:textColor="@android:color/white"
                    android:padding="40px"
                    android:textSize="80px"
                    android:layout_marginLeft="260px"
                    android:layout_marginTop="240px"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:id="@+id/EURUSDSL"/>
                <TextView
                    android:text="@string/my_textchart"
                    android:textStyle="bold"
                    android:textColor="@android:color/holo_orange_dark"
                    android:padding="40px"
                    android:textSize="30px"
                    android:layout_marginTop="365px"
                    android:layout_width="wrap_content"                    
                    android:layout_height="wrap_content"
                    android:id="@+id/EURUSDTechnicalChart"/>

            </FrameLayout>
        </LinearLayout>


        <LinearLayout
            android:layout_width="match_parent"
            android:layout_height="500px"
            android:orientation="horizontal"
            android:layout_marginTop="10px">
            <FrameLayout
                android:layout_width="360px"
                android:layout_height="500px"
                android:id="@+id/frameLayout3"
                android:background="?attr/colorPrimary">
               <!-- <TextView
                    android:text="GBPUSD"
                    android:textAppearance="?android:attr/textAppearanceLarge"
                    android:layout_width="match_parent"
                    android:layout_height="match_parent"
                    android:id="@+id/GBPUSD"
                    android:gravity="center"
                    android:textStyle="bold"/>-->
                <ImageView
                    android:id="@+id/GBPUSD"
                    android:layout_width="match_parent"
                    android:layout_height="300px"
                    android:src="@drawable/gbpusd"
                    android:layout_gravity="center_vertical"
                    android:foregroundGravity="center_vertical"
        />

            </FrameLayout>
            <FrameLayout
                android:layout_width="700px"
                android:layout_height="500px"
                android:id="@+id/frameLayout4"
                android:layout_marginLeft="10px"
                android:background="?attr/colorPrimary">
                <TextView
                    android:text="Signal:"
                    android:textStyle="bold"
                    android:textColor="@android:color/white"
                    android:padding="70px"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"/>
                <TextView
                    android:text="Waiting"
                    android:textStyle="bold"
                    android:padding="40px"
                    android:textSize="80px"
                    android:layout_marginLeft="260px"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:textColor="@android:color/white"
                    android:id="@+id/GBPUSDSIGNAL"/>

                <TextView
                    android:text="TP@:"
                    android:textStyle="bold"
                    android:textColor="@android:color/white"
                    android:padding="70px"
                    android:textSize="80px"
                    android:layout_marginTop="100px"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"/>
                <TextView
                    android:text=""
                    android:textStyle="bold"
                    android:padding="40px"
                    android:textColor="@android:color/white"
                    android:textSize="80px"
                    android:layout_marginLeft="260px"
                    android:layout_marginTop="130px"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:id="@+id/GBPUSDTP"/>
                <TextView
                    android:text="SL@:"
                    android:textStyle="bold"
                    android:textColor="@android:color/white"
                    android:padding="70px"
                    android:textSize="80px"
                    android:layout_marginTop="220px"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"/>

                <TextView
                    android:text=""
                    android:textStyle="bold"
                    android:padding="40px"
                    android:textColor="@android:color/white"
                    android:textSize="80px"
                    android:layout_marginLeft="260px"
                    android:layout_marginTop="240px"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:id="@+id/GBPUSDSL"/>
                 <TextView
                    android:text="@string/my_textchart"
                    android:textStyle="bold"
                    android:textColor="@android:color/holo_orange_dark"
                    android:padding="40px"
                    android:textSize="30px"
                    android:layout_marginTop="365px"
                    android:layout_width="wrap_content"                    
                    android:layout_height="wrap_content"
                    android:id="@+id/GBPUSDTechnicalChart"/>

            </FrameLayout>
        </LinearLayout>

        <LinearLayout
            android:layout_width="match_parent"
            android:layout_height="500px"
            android:orientation="horizontal"
            android:layout_marginTop="10px">
            <FrameLayout
                android:layout_width="360px"
                android:layout_height="500px"
                android:id="@+id/frameLayout5"
                android:background="?attr/colorPrimary">
                <!--<TextView
                    android:text="AUDUSD"
                    android:textAppearance="?android:attr/textAppearanceLarge"
                    android:layout_width="match_parent"
                    android:layout_height="match_parent"
                    android:id="@+id/AUDUSD"
                    android:gravity="center"
                    android:textStyle="bold"/>-->

                <ImageView
                    android:id="@+id/AUDUSD"
                    android:layout_width="match_parent"
                    android:layout_height="300px"
                    android:src="@drawable/audusd"
                    android:layout_gravity="center_vertical"
                    android:foregroundGravity="center_vertical"
        />

            </FrameLayout>
            <FrameLayout
                android:layout_width="700px"
                android:layout_height="500px"
                android:id="@+id/frameLayout6"
                android:layout_marginLeft="10px"
                android:background="?attr/colorPrimary">
                <TextView
                    android:text="Signal:"
                    android:textColor="@android:color/white"
                    android:textStyle="bold"
                    android:padding="70px"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"/>
                <TextView
                    android:text="Waiting"
                    android:textStyle="bold"
                    android:padding="40px"
                    android:textColor="@android:color/white"
                    android:textSize="80px"
                    android:layout_marginLeft="260px"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:id="@+id/AUDUSDSIGNAL"/>

                <TextView
                    android:text="TP@:"
                    android:textStyle="bold"
                    android:textColor="@android:color/white"
                    android:padding="70px"
                    android:textSize="80px"
                    android:layout_marginTop="100px"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"/>
                <TextView
                    android:text=""
                    android:textStyle="bold"
                    android:padding="40px"
                    android:textColor="@android:color/white"
                    android:textSize="80px"
                    android:layout_marginLeft="260px"
                    android:layout_marginTop="130px"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:id="@+id/AUDUSDTP"/>
                <TextView
                    android:text="SL@:"
                    android:textStyle="bold"
                    android:textColor="@android:color/white"
                    android:padding="70px"
                    android:textSize="80px"
                    android:layout_marginTop="220px"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"/>

                <TextView
                    android:text=""
                    android:textStyle="bold"
                    android:padding="40px"
                    android:textColor="@android:color/white"
                    android:textSize="80px"
                    android:layout_marginLeft="260px"
                    android:layout_marginTop="240px"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:id="@+id/AUDUSDSL"/>

                 <TextView
                    android:text="@string/my_textchart"
                    android:textStyle="bold"
                    android:textColor="@android:color/holo_orange_dark"
                    android:padding="40px"
                    android:textSize="30px"
                    android:layout_marginTop="365px"
                    android:layout_width="wrap_content"                    
                    android:layout_height="wrap_content"
                    android:id="@+id/AUDUSDTechnicalChart"/>

            </FrameLayout>
        </LinearLayout>

        <LinearLayout
            android:layout_width="match_parent"
            android:layout_height="500px"
            android:orientation="horizontal"
            android:layout_marginTop="10px">
            <FrameLayout
                android:layout_width="360px"
                android:layout_height="500px"
                android:id="@+id/frameLayout7"
                android:background="?attr/colorPrimary">
                <!--<TextView
                    android:text="EURJPY"
                    android:textAppearance="?android:attr/textAppearanceLarge"
                    android:layout_width="match_parent"
                    android:layout_height="match_parent"
                    android:id="@+id/EURJPY"
                    android:gravity="center"
                    android:textStyle="bold"/>-->
                <ImageView
                    android:id="@+id/EURJPY"
                    android:layout_width="match_parent"
                    android:layout_height="300px"
                    android:src="@drawable/eurjpy"
                    android:layout_gravity="center_vertical"
                    android:foregroundGravity="center_vertical"
        />

            </FrameLayout>
            <FrameLayout
                android:layout_width="700px"
                android:layout_height="500px"
                android:id="@+id/frameLayout8"
                android:layout_marginLeft="10px"
                android:background="?attr/colorPrimary">
                <TextView
                    android:text="Signal:"
                    android:textStyle="bold"
                    android:padding="70px"
                    android:textColor="@android:color/white"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"/>
                <TextView
                    android:text="Waiting"
                    android:textStyle="bold"
                    android:padding="40px"
                    android:textSize="80px"
                    android:textColor="@android:color/white"
                    android:layout_marginLeft="260px"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:id="@+id/EURJPYSIGNAL"/>


                <TextView
                    android:text="TP@:"
                    android:textStyle="bold"
                    android:padding="70px"
                    android:textSize="80px"
                    android:textColor="@android:color/white"
                    android:layout_marginTop="100px"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"/>
                <TextView
                    android:text=""
                    android:textStyle="bold"
                    android:padding="40px"
                    android:textSize="80px"
                    android:textColor="@android:color/white"
                    android:layout_marginLeft="260px"
                    android:layout_marginTop="130px"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:id="@+id/EURJPYTP"/>

                <TextView
                    android:text="SL@:"
                    android:textStyle="bold"
                    android:padding="70px"
                    android:textColor="@android:color/white"
                    android:textSize="80px"
                    android:layout_marginTop="220px"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"/>

                <TextView
                    android:text=""
                    android:textStyle="bold"
                    android:padding="40px"
                    android:textColor="@android:color/white"
                    android:textSize="80px"
                    android:layout_marginLeft="260px"
                    android:layout_marginTop="240px"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:id="@+id/EURJPYSL"/>

                 <TextView
                    android:text="@string/my_textchart"
                    android:textStyle="bold"
                    android:textColor="@android:color/holo_orange_dark"
                    android:padding="40px"
                    android:textSize="30px"
                    android:layout_marginTop="365px"
                    android:layout_width="wrap_content"                    
                    android:layout_height="wrap_content"
                    android:id="@+id/EURJPYTechnicalChart"/>

            </FrameLayout>
        </LinearLayout>
        <LinearLayout
            android:layout_width="match_parent"
            android:layout_height="500px"
            android:orientation="horizontal"
            android:layout_marginTop="10px">
            <FrameLayout
                android:layout_width="360px"
                android:layout_height="500px"
                android:id="@+id/frameLayout9"
                android:background="?attr/colorPrimary">
               <!-- <TextView
                    android:text="GOLD(XAUUSD)"
                    android:textAppearance="?android:attr/textAppearanceLarge"
                    android:layout_width="match_parent"
                    android:layout_height="match_parent"
                    android:id="@+id/GOLD"
                    android:gravity="center"
                    android:textColor="#D2691E"
                    android:textStyle="bold"/>-->
                <ImageView
                    android:id="@+id/GOLD"
                    android:layout_width="match_parent"
                    android:layout_height="300px"
                    android:src="@drawable/xauusd"
                    android:layout_gravity="center_vertical"
                    android:foregroundGravity="center_vertical"
        />

            </FrameLayout>
            <FrameLayout
                android:layout_width="700px"
                android:layout_height="500px"
                android:id="@+id/frameLayout10"
                android:layout_marginLeft="10px"
                android:background="?attr/colorPrimary">
                <TextView
                    android:text="Signal:"
                    android:textColor="@android:color/white"
                    android:textStyle="bold"
                    android:padding="70px"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"/>
                <TextView
                    android:text="Waiting"
                    android:textStyle="bold"
                    android:padding="40px"
                    android:textColor="@android:color/white"
                    android:textSize="80px"
                    android:layout_marginLeft="260px"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:id="@+id/GOLDSIGNAL"/>

                <TextView
                    android:text="TP@:"
                    android:textStyle="bold"
                    android:padding="70px"
                    android:textColor="@android:color/white"
                    android:textSize="80px"
                    android:layout_marginTop="100px"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"/>
                <TextView
                    android:text=""
                    android:textStyle="bold"
                    android:padding="40px"
                    android:textColor="@android:color/white"
                    android:textSize="80px"
                    android:layout_marginLeft="260px"
                    android:layout_marginTop="130px"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:id="@+id/GOLDTP"/>
                <TextView
                    android:text="SL@:"
                    android:textStyle="bold"
                    android:padding="70px"
                    android:textSize="80px"
                    android:textColor="@android:color/white"
                    android:layout_marginTop="220px"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"/>

                <TextView
                    android:text=""
                    android:textStyle="bold"
                    android:padding="40px"
                    android:textSize="80px"
                    android:textColor="@android:color/white"
                    android:layout_marginLeft="260px"
                    android:layout_marginTop="240px"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:id="@+id/GOLDSL"/>
                <TextView
                    android:text="@string/my_textchart"
                    android:textStyle="bold"
                    android:textColor="@android:color/holo_orange_dark"
                    android:padding="40px"
                    android:textSize="30px"
                    android:layout_marginTop="365px"
                    android:layout_width="wrap_content"                    
                    android:layout_height="wrap_content"
                    android:id="@+id/GOLDTechnicalChart"/>
            </FrameLayout>
        </LinearLayout>
    </LinearLayout>

</ScrollView>
Posted
Updated 23-Dec-22 1:58am

1 solution

Quote:
What you need is RelativeLayout which is a little complex but flexible. When the app runs on different size screens, the controls will adapt to them according to your constraints.

https://stackoverflow.com/questions/45630497/alternative-for-viewbox-in-xamarin-forms[^]
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900