1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 | <ScrollView android:id="@+id/scroll" android:layout_width="match_parent" android:layout_height="match_parent"> <LinearLayout android:layout_width="wrap_content" android:layout_height="match_parent" android:orientation="vertical"> <LinearLayout android:layout_width="match_parent" android:layout_height="wrap_content" android:orientation="horizontal"> <TextView android:id="@+id/userid" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginLeft="10dp" android:layout_marginTop="5dp" android:text="코딩슬레이브" android:textSize="15dp" /> <View android:id="@+id/bar3" android:layout_width="1dp" android:layout_height="wrap_content" android:layout_marginTop="5dp" android:layout_marginLeft="5dp" android:background="#a8b545" /> <TextView android:id="@+id/post_text" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginTop="5dp" android:layout_marginLeft="5dp" android:text="글 번호" android:textSize="15dp"/> <TextView android:id="@+id/post_num" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginTop="5dp" android:layout_marginLeft="5dp" android:text="1234" android:textSize="15dp" /> <TextView android:id="@+id/post_date" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="2019.05.22" android:textSize="15dp" android:layout_marginTop="5dp" android:layout_marginLeft="135dp"/> </LinearLayout> <ImageView android:id="@+id/content_image" android:layout_width="wrap_content" android:layout_height="300dp" app:layout_constraintTop_toBottomOf="@id/bar2" app:layout_constraintLeft_toLeftOf="parent" app:layout_constraintRight_toRightOf="parent" android:layout_marginTop="10dp" app:srcCompat="@drawable/yumocha"/> <TextView android:layout_width="match_parent" android:layout_height="match_parent" android:textSize="50dp" android:text="스크롤뷰 텍스트뷰에 적용" app:layout_constraintRight_toRightOf="parent" app:layout_constraintLeft_toLeftOf="parent" /> </LinearLayout> </ScrollView> | cs |
여기서 날짜에 gravity를 주는데 자꾸 이게 right를 주면 자꾸 위로? 옮겨지네요..
지금은 억지로 margin left를 줘서 오른쪽으로 붙여놨는데
이걸 안주면 지금 1234랑 붙어있습니다.
첨에 1234랑 날짜랑 붙어있으니까 떼어내려고
date 텍스트뷰에 gravity 속성을 right를 줘보고 layout_gravity도 right도 줘봤는데..
제자리에서 꿈쩍도 안하고 이상하게 위로 붙네요..
왜이런건가요?
gravity는 자신의 뷰에 속하는 데이터를 움직이는거고
layout_gravity는 부모 레이아웃을 기준으로 데이터를 움직이는거 아닌가요?
왜 오른쪽으로 안붙을까요..
댓글 0