How to create responsive design with overlapping viewsHow do save an Android Activity state using save instance state?How do I center text horizontally and vertically in a TextView?Why is the Android emulator so slow? How can we speed up the Android emulator?How to align views at the bottom of the screen?How to hide the title bar for an Activity in XML with existing custom themeAndroid “Only the original thread that created a view hierarchy can touch its views.”How do I fix android.os.NetworkOnMainThreadException?Android - tiled backgrounds occasionally get stretchedHow do I play an audio file in Android?How to create RecyclerView with multiple view type?

Why is this Simple Puzzle impossible to solve?

What kind of metaphor is "trees in the wind"?

Why does Mjolnir fall down in Age of Ultron but not in Endgame?

Construct a word ladder

If a person had control of every single cell of their body, would they be able to transform into another creature?

Is the field of q-series 'dead'?

Why do Ryanair allow me to book connecting itineraries through a third party, but not through their own website?

What is the object moving across the ceiling in this stock footage?

Binary Search in C++17

Does the unit of measure matter when you are solving for the diameter of a circumference?

Looking for a soft substance that doesn't dissolve underwater

Is CD audio quality good enough?

How should I introduce map drawing to my players?

What is the largest (size) solid object ever dropped from an airplane to impact the ground in freefall?

How to respond to an upset student?

My employer faked my resume to acquire projects

Is real public IP Address hidden when using a system wide proxy in Windows 10?

What are these arcade games in Ghostbusters 1984?

Why do airplanes use an axial flow jet engine instead of a more compact centrifugal jet engine?

Have 1.5% of all nuclear reactors ever built melted down?

Compactness of finite sets

Why were helmets and other body armour not commonplace in the 1800s?

Ticket to ride, 1910: What are the big cities

How to illustrate the Mean Value theorem?



How to create responsive design with overlapping views


How do save an Android Activity state using save instance state?How do I center text horizontally and vertically in a TextView?Why is the Android emulator so slow? How can we speed up the Android emulator?How to align views at the bottom of the screen?How to hide the title bar for an Activity in XML with existing custom themeAndroid “Only the original thread that created a view hierarchy can touch its views.”How do I fix android.os.NetworkOnMainThreadException?Android - tiled backgrounds occasionally get stretchedHow do I play an audio file in Android?How to create RecyclerView with multiple view type?






.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty height:90px;width:728px;box-sizing:border-box;








-1
















I am trying to create a layout which is is somewhat similar to this
which will always be same irrespective of the device screen size




UI



Here the constrains are



  1. Need to overlap Views

    • For this I have to use Relative Layout



  2. TextView must change its size according to the device screen size

    • For this I have to use Linear Layout



ACCORDING TO MY LIMITED KNOWLEDGE BUT BOTH ARE CONFLICTING CONSTRAINS




Here is my code but this is not responsive design



 <RelativeLayout 
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent">

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/topic_name_parent"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_alignParentStart="true"
android:layout_alignParentTop="true"
android:layout_marginStart="0dp"
android:layout_marginTop="0dp"
android:background="#795548"
android:gravity="center"
android:orientation="vertical"
android:weightSum="5">

<TextView
android:id="@+id/topic_name"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_marginLeft="24dp"
android:layout_marginRight="24dp"
android:layout_weight="3"
android:background="@drawable/rounded_corner"
android:gravity="center"
android:lineSpacingExtra="2sp"
android:text="Demo"
android:textColor="#000000"
android:textSize="24sp" />
</LinearLayout>

<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_marginVertical="125dp"
android:layout_marginHorizontal="25dp"
android:src="@drawable/ic_outline_create_24px" />
</RelativeLayout>









share|improve this question
























  • Constraint layout is a good way to go here. developer.android.com/training/constraint-layout

    – Александр Бабич
    Mar 24 at 6:19

















-1
















I am trying to create a layout which is is somewhat similar to this
which will always be same irrespective of the device screen size




UI



Here the constrains are



  1. Need to overlap Views

    • For this I have to use Relative Layout



  2. TextView must change its size according to the device screen size

    • For this I have to use Linear Layout



ACCORDING TO MY LIMITED KNOWLEDGE BUT BOTH ARE CONFLICTING CONSTRAINS




Here is my code but this is not responsive design



 <RelativeLayout 
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent">

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/topic_name_parent"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_alignParentStart="true"
android:layout_alignParentTop="true"
android:layout_marginStart="0dp"
android:layout_marginTop="0dp"
android:background="#795548"
android:gravity="center"
android:orientation="vertical"
android:weightSum="5">

<TextView
android:id="@+id/topic_name"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_marginLeft="24dp"
android:layout_marginRight="24dp"
android:layout_weight="3"
android:background="@drawable/rounded_corner"
android:gravity="center"
android:lineSpacingExtra="2sp"
android:text="Demo"
android:textColor="#000000"
android:textSize="24sp" />
</LinearLayout>

<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_marginVertical="125dp"
android:layout_marginHorizontal="25dp"
android:src="@drawable/ic_outline_create_24px" />
</RelativeLayout>









share|improve this question
























  • Constraint layout is a good way to go here. developer.android.com/training/constraint-layout

    – Александр Бабич
    Mar 24 at 6:19













-1












-1








-1









I am trying to create a layout which is is somewhat similar to this
which will always be same irrespective of the device screen size




UI



Here the constrains are



  1. Need to overlap Views

    • For this I have to use Relative Layout



  2. TextView must change its size according to the device screen size

    • For this I have to use Linear Layout



ACCORDING TO MY LIMITED KNOWLEDGE BUT BOTH ARE CONFLICTING CONSTRAINS




Here is my code but this is not responsive design



 <RelativeLayout 
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent">

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/topic_name_parent"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_alignParentStart="true"
android:layout_alignParentTop="true"
android:layout_marginStart="0dp"
android:layout_marginTop="0dp"
android:background="#795548"
android:gravity="center"
android:orientation="vertical"
android:weightSum="5">

<TextView
android:id="@+id/topic_name"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_marginLeft="24dp"
android:layout_marginRight="24dp"
android:layout_weight="3"
android:background="@drawable/rounded_corner"
android:gravity="center"
android:lineSpacingExtra="2sp"
android:text="Demo"
android:textColor="#000000"
android:textSize="24sp" />
</LinearLayout>

<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_marginVertical="125dp"
android:layout_marginHorizontal="25dp"
android:src="@drawable/ic_outline_create_24px" />
</RelativeLayout>









share|improve this question

















I am trying to create a layout which is is somewhat similar to this
which will always be same irrespective of the device screen size




UI



Here the constrains are



  1. Need to overlap Views

    • For this I have to use Relative Layout



  2. TextView must change its size according to the device screen size

    • For this I have to use Linear Layout



ACCORDING TO MY LIMITED KNOWLEDGE BUT BOTH ARE CONFLICTING CONSTRAINS




Here is my code but this is not responsive design



 <RelativeLayout 
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent">

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/topic_name_parent"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_alignParentStart="true"
android:layout_alignParentTop="true"
android:layout_marginStart="0dp"
android:layout_marginTop="0dp"
android:background="#795548"
android:gravity="center"
android:orientation="vertical"
android:weightSum="5">

<TextView
android:id="@+id/topic_name"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_marginLeft="24dp"
android:layout_marginRight="24dp"
android:layout_weight="3"
android:background="@drawable/rounded_corner"
android:gravity="center"
android:lineSpacingExtra="2sp"
android:text="Demo"
android:textColor="#000000"
android:textSize="24sp" />
</LinearLayout>

<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_marginVertical="125dp"
android:layout_marginHorizontal="25dp"
android:src="@drawable/ic_outline_create_24px" />
</RelativeLayout>






android android-layout






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Mar 24 at 6:10







Bhaskar

















asked Mar 24 at 6:02









BhaskarBhaskar

366




366












  • Constraint layout is a good way to go here. developer.android.com/training/constraint-layout

    – Александр Бабич
    Mar 24 at 6:19

















  • Constraint layout is a good way to go here. developer.android.com/training/constraint-layout

    – Александр Бабич
    Mar 24 at 6:19
















Constraint layout is a good way to go here. developer.android.com/training/constraint-layout

– Александр Бабич
Mar 24 at 6:19





Constraint layout is a good way to go here. developer.android.com/training/constraint-layout

– Александр Бабич
Mar 24 at 6:19












1 Answer
1






active

oldest

votes


















0














Try this using ConstraintLayout



<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/colorPrimary">

<TextView
android:id="@+id/topic_name"
android:layout_width="match_parent"
android:layout_height="0dp"
android:gravity="center"
android:lineSpacingExtra="2sp"
android:text="Demo"
android:textColor="#000000"
android:textSize="24sp"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toTopOf="@+id/guideline" />

<android.support.constraint.Guideline
android:id="@+id/guideline"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="horizontal"
app:layout_constraintGuide_percent="0.5" />

<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentEnd="true"
android:layout_margin="10dp"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:srcCompat="@drawable/ic_close" />


</androidx.constraintlayout.widget.ConstraintLayout>


OUTPUT



enter image description here






share|improve this answer























    Your Answer






    StackExchange.ifUsing("editor", function ()
    StackExchange.using("externalEditor", function ()
    StackExchange.using("snippets", function ()
    StackExchange.snippets.init();
    );
    );
    , "code-snippets");

    StackExchange.ready(function()
    var channelOptions =
    tags: "".split(" "),
    id: "1"
    ;
    initTagRenderer("".split(" "), "".split(" "), channelOptions);

    StackExchange.using("externalEditor", function()
    // Have to fire editor after snippets, if snippets enabled
    if (StackExchange.settings.snippets.snippetsEnabled)
    StackExchange.using("snippets", function()
    createEditor();
    );

    else
    createEditor();

    );

    function createEditor()
    StackExchange.prepareEditor(
    heartbeatType: 'answer',
    autoActivateHeartbeat: false,
    convertImagesToLinks: true,
    noModals: true,
    showLowRepImageUploadWarning: true,
    reputationToPostImages: 10,
    bindNavPrevention: true,
    postfix: "",
    imageUploader:
    brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
    contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
    allowUrls: true
    ,
    onDemand: true,
    discardSelector: ".discard-answer"
    ,immediatelyShowMarkdownHelp:true
    );



    );













    draft saved

    draft discarded


















    StackExchange.ready(
    function ()
    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55321149%2fhow-to-create-responsive-design-with-overlapping-views%23new-answer', 'question_page');

    );

    Post as a guest















    Required, but never shown

























    1 Answer
    1






    active

    oldest

    votes








    1 Answer
    1






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes









    0














    Try this using ConstraintLayout



    <androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:background="@color/colorPrimary">

    <TextView
    android:id="@+id/topic_name"
    android:layout_width="match_parent"
    android:layout_height="0dp"
    android:gravity="center"
    android:lineSpacingExtra="2sp"
    android:text="Demo"
    android:textColor="#000000"
    android:textSize="24sp"
    app:layout_constraintLeft_toLeftOf="parent"
    app:layout_constraintRight_toRightOf="parent"
    app:layout_constraintTop_toTopOf="@+id/guideline" />

    <android.support.constraint.Guideline
    android:id="@+id/guideline"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:orientation="horizontal"
    app:layout_constraintGuide_percent="0.5" />

    <ImageView
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_alignParentEnd="true"
    android:layout_margin="10dp"
    app:layout_constraintEnd_toEndOf="parent"
    app:layout_constraintTop_toTopOf="parent"
    app:srcCompat="@drawable/ic_close" />


    </androidx.constraintlayout.widget.ConstraintLayout>


    OUTPUT



    enter image description here






    share|improve this answer



























      0














      Try this using ConstraintLayout



      <androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
      xmlns:app="http://schemas.android.com/apk/res-auto"
      android:layout_width="match_parent"
      android:layout_height="match_parent"
      android:background="@color/colorPrimary">

      <TextView
      android:id="@+id/topic_name"
      android:layout_width="match_parent"
      android:layout_height="0dp"
      android:gravity="center"
      android:lineSpacingExtra="2sp"
      android:text="Demo"
      android:textColor="#000000"
      android:textSize="24sp"
      app:layout_constraintLeft_toLeftOf="parent"
      app:layout_constraintRight_toRightOf="parent"
      app:layout_constraintTop_toTopOf="@+id/guideline" />

      <android.support.constraint.Guideline
      android:id="@+id/guideline"
      android:layout_width="wrap_content"
      android:layout_height="wrap_content"
      android:orientation="horizontal"
      app:layout_constraintGuide_percent="0.5" />

      <ImageView
      android:layout_width="wrap_content"
      android:layout_height="wrap_content"
      android:layout_alignParentEnd="true"
      android:layout_margin="10dp"
      app:layout_constraintEnd_toEndOf="parent"
      app:layout_constraintTop_toTopOf="parent"
      app:srcCompat="@drawable/ic_close" />


      </androidx.constraintlayout.widget.ConstraintLayout>


      OUTPUT



      enter image description here






      share|improve this answer

























        0












        0








        0







        Try this using ConstraintLayout



        <androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
        xmlns:app="http://schemas.android.com/apk/res-auto"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:background="@color/colorPrimary">

        <TextView
        android:id="@+id/topic_name"
        android:layout_width="match_parent"
        android:layout_height="0dp"
        android:gravity="center"
        android:lineSpacingExtra="2sp"
        android:text="Demo"
        android:textColor="#000000"
        android:textSize="24sp"
        app:layout_constraintLeft_toLeftOf="parent"
        app:layout_constraintRight_toRightOf="parent"
        app:layout_constraintTop_toTopOf="@+id/guideline" />

        <android.support.constraint.Guideline
        android:id="@+id/guideline"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:orientation="horizontal"
        app:layout_constraintGuide_percent="0.5" />

        <ImageView
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignParentEnd="true"
        android:layout_margin="10dp"
        app:layout_constraintEnd_toEndOf="parent"
        app:layout_constraintTop_toTopOf="parent"
        app:srcCompat="@drawable/ic_close" />


        </androidx.constraintlayout.widget.ConstraintLayout>


        OUTPUT



        enter image description here






        share|improve this answer













        Try this using ConstraintLayout



        <androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
        xmlns:app="http://schemas.android.com/apk/res-auto"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:background="@color/colorPrimary">

        <TextView
        android:id="@+id/topic_name"
        android:layout_width="match_parent"
        android:layout_height="0dp"
        android:gravity="center"
        android:lineSpacingExtra="2sp"
        android:text="Demo"
        android:textColor="#000000"
        android:textSize="24sp"
        app:layout_constraintLeft_toLeftOf="parent"
        app:layout_constraintRight_toRightOf="parent"
        app:layout_constraintTop_toTopOf="@+id/guideline" />

        <android.support.constraint.Guideline
        android:id="@+id/guideline"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:orientation="horizontal"
        app:layout_constraintGuide_percent="0.5" />

        <ImageView
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignParentEnd="true"
        android:layout_margin="10dp"
        app:layout_constraintEnd_toEndOf="parent"
        app:layout_constraintTop_toTopOf="parent"
        app:srcCompat="@drawable/ic_close" />


        </androidx.constraintlayout.widget.ConstraintLayout>


        OUTPUT



        enter image description here







        share|improve this answer












        share|improve this answer



        share|improve this answer










        answered Mar 24 at 6:21









        Nilesh RathodNilesh Rathod

        35.5k93565




        35.5k93565





























            draft saved

            draft discarded
















































            Thanks for contributing an answer to Stack Overflow!


            • Please be sure to answer the question. Provide details and share your research!

            But avoid


            • Asking for help, clarification, or responding to other answers.

            • Making statements based on opinion; back them up with references or personal experience.

            To learn more, see our tips on writing great answers.




            draft saved


            draft discarded














            StackExchange.ready(
            function ()
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55321149%2fhow-to-create-responsive-design-with-overlapping-views%23new-answer', 'question_page');

            );

            Post as a guest















            Required, but never shown





















































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown

































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown







            Popular posts from this blog

            Kamusi Yaliyomo Aina za kamusi | Muundo wa kamusi | Faida za kamusi | Dhima ya picha katika kamusi | Marejeo | Tazama pia | Viungo vya nje | UrambazajiKuhusu kamusiGo-SwahiliWiki-KamusiKamusi ya Kiswahili na Kiingerezakuihariri na kuongeza habari

            SQL error code 1064 with creating Laravel foreign keysForeign key constraints: When to use ON UPDATE and ON DELETEDropping column with foreign key Laravel error: General error: 1025 Error on renameLaravel SQL Can't create tableLaravel Migration foreign key errorLaravel php artisan migrate:refresh giving a syntax errorSQLSTATE[42S01]: Base table or view already exists or Base table or view already exists: 1050 Tableerror in migrating laravel file to xampp serverSyntax error or access violation: 1064:syntax to use near 'unsigned not null, modelName varchar(191) not null, title varchar(191) not nLaravel cannot create new table field in mysqlLaravel 5.7:Last migration creates table but is not registered in the migration table

            은진 송씨 목차 역사 본관 분파 인물 조선 왕실과의 인척 관계 집성촌 항렬자 인구 같이 보기 각주 둘러보기 메뉴은진 송씨세종실록 149권, 지리지 충청도 공주목 은진현