Skip to content

JassWeb

  • Home
  • Solved
    • javascript
    • c++
    • java
    • git
    • php
    • arrays
    • html
    • python
    • jquery
    • mysql
    • .net
    • json
    • ajax

[Solved] How would I go about making this layout? [closed]

November 7, 2022 by Kirat


It’s a pretty simple layout actually, the only problem is making FAB in between 2 views.

Don’t forget compile 'com.android.support:design:22.2.0' in gradle.

<android.support.design.widget.CoordinatorLayout
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">

<LinearLayout android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:orientation="vertical">

    <LinearLayout
        android:id="@+id/viewA"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:layout_weight="0.6"
        android:background="#acacac"
        android:orientation="horizontal"/>

    <LinearLayout
        android:id="@+id/viewB"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:layout_weight="0.4"
        android:background="#bebebe"
        android:orientation="vertical">

        <LinearLayout
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:orientation="horizontal"
            android:layout_marginTop="30dp"
            android:layout_marginRight="20dp"
            android:layout_marginLeft="20dp">

            <ImageView
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_gravity="center"
                android:layout_marginRight="20dp"
                android:layout_marginEnd="20dp"
                android:src="https://stackoverflow.com/questions/31095846/@drawable/ic_palette_grey600_24dp"/>

            <EditText
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:hint="Name"/>

        </LinearLayout>

        <LinearLayout
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:orientation="horizontal"
            android:layout_marginLeft="20dp"
            android:layout_marginRight="20dp">

            <ImageView
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_gravity="center"
                android:layout_marginRight="20dp"
                android:layout_marginEnd="20dp"
                android:src="https://stackoverflow.com/questions/31095846/@drawable/ic_palette_grey600_24dp"/>

            <EditText
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:hint="City"/>

        </LinearLayout>

        <LinearLayout
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:orientation="horizontal"
            android:layout_marginRight="20dp"
            android:layout_marginLeft="20dp">

            <ImageView
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_gravity="center"
                android:layout_marginRight="20dp"
                android:layout_marginEnd="20dp"
                android:src="https://stackoverflow.com/questions/31095846/@drawable/ic_palette_grey600_24dp"/>

            <EditText
                android:layout_width="0dp"
                android:layout_height="wrap_content"
                android:layout_weight="1"
                android:hint="Address"/>

            <Spinner
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:entries="@array/array"
                android:prompt="@string/prompt"/>

        </LinearLayout>

    </LinearLayout>

</LinearLayout>

<android.support.design.widget.FloatingActionButton
    android:id="@+id/fab"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_margin="16dp"
    android:clickable="true"
    android:src="@drawable/ic_add_white_24dp"
    app:borderWidth="0dp"
    app:backgroundTint="@android:color/holo_green_dark"
    app:layout_anchor="@id/viewA"
    app:layout_anchorGravity="bottom|right|end"/>

</android.support.design.widget.CoordinatorLayout>

Gives this result (styling of spinner and edittext is on you – this is on api 18) :

enter image description here

solved How would I go about making this layout? [closed]

Categories Solved Tags android, layout, user-profile, xml
[Solved] if-statement gives another result than expected
[Solved] i want to make typing ‘http://’ is not necessary. how can i do?

Recent Posts

  • [Solved] Check to see if two lists have the same value at the same index, if so return the index. If not return -1
  • [Solved] Generics C# organization of methods that depends on type [closed]
  • [Solved] Database – SQL Table to Perl Script
  • [Solved] Comment xml elements programmatically
  • [Solved] Logging printout of an executed python file within another file and printing out the result in terminal simultaneously

Archives

  • November 2023
  • June 2023
  • April 2023
  • March 2023
  • February 2023
  • January 2023
  • December 2022
  • November 2022
  • October 2022
  • September 2022
  • August 2022
  • November 2021
  • August 2020
  • March 2020
  • June 2019
  • February 2019
  • September 2018
  • August 2018
  • July 2018
  • March 2018
  • February 2018
  • December 2017
  • October 2017
  • August 2017
  • January 2017
  • September 2016
  • May 2016
  • January 2016
  • October 2015
  • July 2015
  • February 2015
  • December 2014
  • November 2014
  • September 2014
  • August 2014
  • July 2014
  • June 2014
  • May 2014
  • March 2014
  • January 2014
  • January 2013
  • October 2012
  • March 2012
  • October 2011
  • March 2011
  • January 2010
  • September 2009
  • May 2009
  • February 2009
  • January 2009
  • October 2007
  • January 2007
  • November 2004
  • May 2002
  • September 2001
  • May 2001

Categories

  • Solved
  • WordPress

Quick Links

© 2025 JassWeb • Built with GeneratePress