마스터Q&A 안드로이드는 안드로이드 개발자들의 질문과 답변을 위한 지식 커뮤니티 사이트입니다. 안드로이드펍에서 운영하고 있습니다. [사용법, 운영진]

자바 스크롤뷰 적용하는 법

0 추천
https://codelist.tistory.com/42

 

여기에 있는 스크롤 뷰 하는 곳 constraint로 어떻게 해야하나요? 이미지 텍스트 넣으려고 하면 위치 조정이 안되어서 질문드립니다.

 

아니면 하단 바만 고정시키고 그 위에 있는 레이아웃만 스크롤 시키는 거는 어떻게 구현하는지 궁금합니다. constraint 레이아웃으로 하면 튕기는 문제가 발생하는거 같아요.
enerigpy (2,110 포인트) 님이 2022년 11월 18일 질문

1개의 답변

0 추천
 
채택된 답변

스크롤뷰 constraint에 대한 첫번째 질문을 잘 이애하지를 못하겠네요. 혹 스크롤뷰 안에 LinearLayout 대신 ConstraintLayout를 사용하고 싶으신건지... 잘 모르겠네요.

두번째 질문은 이미 레이아웃에 작업이 거의 되어 있어 보이네요. 기본적으로 BottomNavigationView을 하단에 붙여서 위치시키고 화면 상단부터 BottomNavigationView 전까지를 스크롤 영역으로 지정하면 됩니다.

<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.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">

    <ScrollView
        android:id="@+id/scrollView2"
        android:layout_width="0dp"
        android:layout_height="0dp"
        app:layout_constraintStart_toStartOf="parent"
        app:layout_constraintEnd_toEndOf="parent"
        app:layout_constraintTop_toTopOf="parent"
        app:layout_constraintBottom_toTopOf="@id/navigationView"
        android:orientation="vertical">

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

            ...
        </LinearLayout>
    </ScrollView>

    <com.google.android.material.bottomnavigation.BottomNavigationView
        android:id="@+id/navigationView"
        ...
        app:layout_constraintBottom_toBottomOf="parent"
        app:layout_constraintStart_toStartOf="parent"
        app:layout_constraintEnd_toEndOf="parent" />

</androidx.constraintlayout.widget.ConstraintLayout>

 

spark (224,800 포인트) 님이 2022년 11월 18일 답변
enerigpy님이 2022년 11월 21일 채택됨
linear 로 하면 이미지 위치 조정을 할수 없어서 스크롤뷰 안에 constraint로 하려고 하는데 오류가 나서 질문드린거에요!
에러가 있다면 에러메세지를 올려보세요.
...