logo
down
shadow

ConstraintLayout match parent height on larger screens but scroll on smaller


ConstraintLayout match parent height on larger screens but scroll on smaller

Content Index :

ConstraintLayout match parent height on larger screens but scroll on smaller
Tag : android , By : Erik
Date : November 25 2020, 07:22 PM

Any of those help Set the height of the middle TextView to 0dp (to match constraints) to fill the available space and add android:fillViewport="true" attribute to your ScrollView to stretch its content to fill the viewport.
<?xml version="1.0" encoding="utf-8"?>
<ScrollView
        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:fillViewport="true">

    <android.support.constraint.ConstraintLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content">

        <TextView
            android:id="@+id/top"
            android:layout_width="0dp"
            android:layout_height="wrap_content"
            android:background="@color/gray"
            android:gravity="center"
            android:padding="10dp"
            android:text="top"
            android:textColor="@color/white"
            app:layout_constraintEnd_toEndOf="parent"
            app:layout_constraintStart_toStartOf="parent"
            app:layout_constraintTop_toTopOf="parent" />

        <TextView
            android:id="@+id/middle"
            android:layout_width="0dp"
            android:layout_height="0dp"
            android:background="@color/green"
            android:gravity="center"
            android:padding="10dp"
            android:text="middle"
            android:textColor="@color/white"
            app:layout_constraintHeight_min="300dp"
            app:layout_constraintBottom_toTopOf="@id/bottom"
            app:layout_constraintEnd_toEndOf="parent"
            app:layout_constraintStart_toStartOf="parent"
            app:layout_constraintTop_toBottomOf="@id/top" />

        <TextView
            android:id="@+id/bottom"
            android:layout_width="0dp"
            android:layout_height="wrap_content"
            android:background="@color/gray"
            android:gravity="center"
            android:padding="10dp"
            android:text="bottom"
            android:textColor="@color/white"
            app:layout_constraintBottom_toBottomOf="parent"
            app:layout_constraintEnd_toEndOf="parent"
            app:layout_constraintStart_toStartOf="parent" />

    </android.support.constraint.ConstraintLayout>
</ScrollView>

Comments
No Comments Right Now !

Boards Message :
You Must Login Or Sign Up to Add Your Comments .

Share : facebook icon twitter icon

Flex container with four columns on larger screens and three columns on smaller screens


Tag : html , By : picamiolo
Date : March 29 2020, 07:55 AM
hope this fix your issue Yeah, flex can take a little bit to get used to, but once you get it you're be harnessing a really powerful native layout system. Here is an updated jsbin for your answer that does what's you've asked for: http://jsbin.com/qocuwokeqa/edit?html,css,output
I'll explain a bit what I did:
#container {
  display: flex;
  flex-wrap: wrap;
}
.item {
  width: 23%;
  background: yellow;
  margin-bottom: 5px;
  margin-right: 5px;
  padding: 5px;
  flex: 1 1 auto;
}
flex: 1 1 auto
flex-grow: 1;
flex-shrink: 1;
flex-basis: auto;

Mobile - Media query for smaller screens applying for larger screens


Tag : css , By : Ben Humphrys
Date : March 29 2020, 07:55 AM
like below fixes the issue I have the following media query for a mobile app, , Try using device-height
@media only screen 
and (max-device-height: 630px)
and (orientation: portrait)  {
        /* Code */
    }

ConstraintLayout Resize views for smaller Screens


Tag : android , By : Vrki
Date : March 29 2020, 07:55 AM
around this issue
I thought that all the views will be shrunk to accommodate the rest.

CSS For Smaller Screens overidden by CSS for Larger Screens


Tag : html , By : Arun Thakkar
Date : March 29 2020, 07:55 AM
wish of those help I am trying to use a responsive grid view to show three items: , You can do it by changing the flex direction of your container.
flex-direction: column;

How to set a view's height match parent in ConstraintLayout?


Tag : android , By : Heals1ic
Date : March 29 2020, 07:55 AM
Hope this helps Solution: I'm assuming that you have your toolbar as another xml file, something like this:
toolbar.xml
<android.support.v7.widget.Toolbar
    xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    android:id="@+id/toolbar"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:minHeight="60dp"
    android:background="?attr/colorPrimary"
    android:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar"
    app:popupTheme="@style/ThemeOverlay.AppCompat.Light" />
<?xml version="1.0" encoding="utf-8"?>
<android.support.constraint.ConstraintLayout 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:layout_width="match_parent"
    android:layout_height="match_parent"
    tools:context=".MainActivity">

    <include
        android:id="@+id/toolbar"
        layout="@layout/toolbar"
        app:layout_constraintEnd_toEndOf="parent"
        app:layout_constraintStart_toStartOf="parent"
        app:layout_constraintTop_toTopOf="parent" />

    <FrameLayout
        android:id="@+id/container"
        android:layout_width="0dp"
        android:layout_height="0dp"
        app:layout_constraintBottom_toBottomOf="parent"
        app:layout_constraintEnd_toEndOf="parent"
        app:layout_constraintStart_toStartOf="parent"
        app:layout_constraintTop_toBottomOf="@+id/toolbar" />

</android.support.constraint.ConstraintLayout>
Related Posts Related QUESTIONS :
  • VpnService always-on "not supported by this app"
  • Android Studio - Gradle "Sync now" is not Available
  • How do i get my code to give my current location?
  • Could not initialize class sun.util.calendar.ZoneInfoFile while using Flutter firebase-notifications
  • How to implement circular to check / tick animation in Android?
  • Toolbar shadow not showing
  • Android Sqlite get rows where first character is not an Alphabet
  • why I receive "bad request" in my request by retrofit
  • Intercept NavigationUI.onNavDestinationSelected() to make backstack pop with "inclusive = true"
  • I have a problem with the navigation fragments in my proyect, it sais that I need a defaut nav host atribute but I alrea
  • How can I keep a BottomSheetDialogFragment height to always match_parent?
  • How to reference a timerPicker in android studio using kotlin
  • Firebase Crashlytics - get stacktrace info to display during CrashlyticsListener.crashlyticsDidDetectCrashDuringPrevious
  • Schedule a repeating alarm clock
  • Can't assign values outside onTouchListener
  • Is setContentView() needed to inflate a fragment?
  • Why instead of string method returns Kotlin.Unit?
  • Retrofit slash as Query
  • When does onCreateView() get called in this app?
  • Fragment is reloaded each time after rejecting location permission
  • How to read ViewModel data from sttrings.xml list of items
  • Flutter doctor does not see vs code ,VS code does not detect flutter/bin
  • How to build aar in flutter
  • Is displayMetrix xdpi and ydpi accurate?
  • How to detect doubletap on a View?
  • how to play an encrypted file in Android
  • Android: keytool error on the command line when locating debug.keystore
  • Android paint/canvas issue; drawing smooth curves
  • Problems with starting an activity in onStart
  • Performance of map overlay in conjunction with ItemizedOverlay is very poor
  • How to change android indeterminate ProgressBar color?
  • How do I change the Mobile Country Code (MCC) in the Android Emulator?
  • Stop Progressbar manual scrolling in Android
  • Android: download large file
  • Android : uploaded .apk file to server but cant download that .apk file
  • How do I distribute Android app to beta tester without using Market
  • Android Unable to launch the Inbox from a notification
  • Android: Ringer mode changed to silent doesn't stop the phone vibrating
  • Change the side the text appears on a radio button
  • Check the memory usage anp cpu and power of an application in android
  • What is the String 'volumeName' argument of MediaStore.Audio.Playlists.Members.getContentUri referring to?
  • Playing Multiple sounds at the same time in Android
  • Android: how to change the time in emulator?
  • close the soft key pad when i click on other views in android
  • Setting the position within a spinner
  • How to play ringtone/alarm sound in Android
  • How to adjust text font size to fit textview
  • "Android 2.x" vs "Google APIs" for Android AVD Setup
  • How to center buttons on screen horizontally and vertically plus equidistant apart?
  • Discrete seekbar in Android app?
  • Gradle Build Fails - Illegal exception table range in class file com/google/wireless/android/sdk/stats/GradleBuildMemory
  • register has type Long (High Half) but expected Long (Low Half)
  • Is it good idea to use Dispatcher.Main with delay( )?
  • WebView and Advanced View is Not loading partiucalr URL
  • How to show three dots at the end of text view
  • Is it possible to run macros within Android Studio project?
  • Adding a button with default appearance but changed background color
  • What is best way to show notification at a certain time in Android?
  • Jetifier not working when library uses android component and app uses androidx component
  • How can I write the contents of an image in a filesystem
  • shadow
    Privacy Policy - Terms - Contact Us © scrbit.com