[Android] ScrollView with ConstraintLayout

2020. 7. 7. 09:54·Android

 

 

 

ScrollView는 LinearLayout, FrameLayout 등 반드시 감싸는 레이아웃 구조가 하나 있어야함.

∵ 자체적으로 위젯 객체에대한 정보를 가지지 않음.

 

 

 

 

 

ScrollView 내부에 ConstraintLayout을 지정하는 경우

ScrollView 대신 NestedScrollView 사용 권장 
ScrollView의 제약 조건범위를 모두 명시 (위,아래, 왼,오른)

 

// 아래 제약조건중 Bottom_toBottomOf 속성 하나만 빼놔도 정상적으로 작동하지 않게된다.
<androidx.core.widget.NestedScrollView
            android:id="@+id/scrollView"
            android:layout_width="match_parent"
            android:layout_height="0dp"
            android:layout_marginTop="70dp"
            android:fillViewport="true"
            app:layout_constraintStart_toStartOf="parent"
            app:layout_constraintEnd_toEndOf="parent"
            app:layout_constraintTop_toBottomOf="@+id/store_name_layout"
            app:layout_constraintBottom_toBottomOf="parent">
            
        <androidx.constraintlayout.widget.ConstraintLayout
                android:id="@+id/store_info_layout"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:layout_marginHorizontal="50dp"
                app:layout_constraintTop_toBottomOf="@id/store_name_layout">

[Reference]

https://stackoverflow.com/questions/57303268/scrollview-not-working-inside-constraint-layout

저작자표시 (새창열림)

'Android' 카테고리의 다른 글

Android release Alpha vs Beta  (0) 2020.12.09
[Android] Activity to Activity Data Pass (feat. Intent)  (0) 2020.07.06
[Android] SharedPreference  (0) 2020.07.03
[Android] instance  (0) 2020.07.03
[Android] Service 2편 (Foreground)  (0) 2020.06.22
'Android' 카테고리의 다른 글
  • Android release Alpha vs Beta
  • [Android] Activity to Activity Data Pass (feat. Intent)
  • [Android] SharedPreference
  • [Android] instance
M_Falcon
M_Falcon
  • M_Falcon
    Falcon
    M_Falcon
  • 전체
    오늘
    어제
    • 분류 전체보기 (432) N
      • Web (16)
        • Nodejs (14)
        • Javascript (23)
        • FrontEnd (4)
      • DataBase (39)
        • Fundamental (1)
        • Redis (4)
        • PostgreSQL (10)
        • NoSQL (4)
        • MySQL (9)
        • MSSQL (3)
        • Error (4)
      • Algorithm (79)
        • Algorithm (문제풀이) (56)
        • Algorithm (이론) (23)
      • JVM (65)
        • Spring (13)
        • JPA (5)
        • Kotlin (13)
        • Java (24)
        • Error (7)
      • 기타 (70) N
        • Kafka (3)
        • Kubernetes (3)
        • Docker (13) N
        • git (19)
        • 잡동사니 (27)
      • 재테크 (11)
        • 세무 (4)
        • 투자 (3)
        • 보험 (0)
      • BlockChain (2)
        • BitCoin (0)
      • C (32)
        • C (10)
        • C++ (17)
        • Error (3)
      • Low Level (8)
        • OS (3)
        • 시스템 보안 (5)
      • 네트워크 (3)
      • LINUX (30)
        • Linux (26)
        • Error (4)
      • 저작권과 스마트폰의 이해 (0)
      • 생각 뭉치 (6)
      • 궁금증 (2)
      • Private (4)
        • 이직 경험 (0)
        • 꿈을 찾아서 (1)
      • Android (21)
        • OS (4)
  • 블로그 메뉴

    • 홈
    • WEB
    • 알고리즘
    • DataBase
    • Linux
    • Mobile
    • C
    • 방명록
  • 링크

    • github
  • 공지사항

  • 인기 글

  • 태그

    kafka
    docker
    백준
    C++
    Git
    android
    ubuntu
    Bitcoin
    database
    Spring
    Kotlin
    javascript
    algorithm
    JPA
    알고리즘
    java
    PostgreSQL
    프로그래머스
    linux
    Programmers
  • hELLO· Designed By정상우.v4.10.3
M_Falcon
[Android] ScrollView with ConstraintLayout
상단으로

티스토리툴바