-
linearlayout 오른쪽 정렬 , 오른쪽으로 이동Android/UI 2022. 8. 28. 18:35
원래는 이런 디자인
하지만 메뉴모양을 오른쪽으로 이동하고 싶다.
위젯과 위젯사이에 다음과 같은 코드를 추가하자.
<View android:layout_width="0dp" android:layout_height="0dp" android:layout_weight="1" />
그리고 오른쪽으로 이동하고 싶은 위젯에
android:layout_gravity="right"
전체 xml 코드
<LinearLayout android:layout_width="match_parent" android:layout_height="wrap_content" android:orientation="horizontal"> <ImageView android:layout_marginLeft="5dp" android:id="@+id/commnet_userimage" android:layout_width="wrap_content" android:layout_height="wrap_content" android:src="@drawable/ic_baseline_face_24"/> <TextView android:layout_marginLeft="5dp" android:layout_marginTop="2dp" android:id="@+id/comment_username" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="닉네임" android:textSize="11sp" android:textColor="@color/black" android:letterSpacing="-0.05" android:layout_marginBottom="8dp"/> <View android:layout_width="0dp" android:layout_height="0dp" android:layout_weight="1" /> <ImageView android:layout_marginRight="5dp" android:layout_gravity="right" android:id="@+id/commnet_more" android:layout_width="wrap_content" android:layout_height="wrap_content" android:src="@drawable/ic_baseline_more_horiz_24"/> </LinearLayout>
'Android > UI' 카테고리의 다른 글
linearlayout item 가운데 정렬 (0) 2022.08.28 [android] background 투명 무색 설정, 투명색 (0) 2022.08.24 [android] 상태바 status bar 색상 바꾸기 (0) 2022.08.20