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

check 박스 문의 합니다.

0 추천
<LinearLayout
                android:id="@+id/llcashType"
                android:layout_width="match_parent"
                android:layout_height="235dp"
                android:orientation="vertical" >
<!--        <Space
                    android:layout_width="match_parent"
                    android:layout_height="0dp"
                    android:layout_weight="1.7" /> -->

                <LinearLayout
                    android:layout_width="match_parent"
                    android:layout_height="232dp"
                    android:layout_marginLeft="30dp"
                    android:layout_marginRight="30dp"
                    android:orientation="vertical" >

                 <Space
                        android:layout_width="0dp"
                        android:layout_height="wrap_content"
                        android:layout_weight="1" />
                     <Button
                        android:id="@+id/cashType_btn"
                          android:layout_width="match_parent"
                          android:layout_height="70sp"
                        android:layout_gravity="center"
                        android:background="@drawable/popup_titlebar_blue_bg"
                        android:text="멤버십 사용/적립"
                        android:textColor="@color/white"
                        android:textSize="20sp">
                        </Button>
                         <Space
                        android:layout_width="match_parent"
                        android:layout_height="10dp"/>

                    <CheckBox
                        android:id="@+id/cashType"
                        android:layout_width="match_parent"
                        android:layout_height="70sp"
                        android:gravity="center"
                        android:background="@drawable/popup_titlebar_blue_bg"
                        android:checked="false"
                        android:text="현금영수증발행"
                        android:textColor="@color/white"
                        android:textSize="20sp" >
                    </CheckBox>
   <Space
                        android:layout_width="0dp"
                        android:layout_height="wrap_content"
                        android:layout_weight="1" />
                   </LinearLayout>
                   
                <Space
                    android:layout_width="match_parent"
                    android:layout_height="0dp"
                    android:layout_weight="0.5" />
            </LinearLayout>
        </LinearLayout>

버튼과  체크 박스  크기가 같고 글자 크기가 같습니다 여기서 문제가 체크박스에서 체크 하는 부분만 왼쪽에 붙어 있습니다 체크박스내의 text는 중앙으로 가있구요

둘다 중앙정력 하고싶습니다

감사합니다
익명사용자 님이 2016년 9월 29일 질문

2개의 답변

0 추천
정력에는 민물장어~~가 최곱니다...
앤드류이드 (6,190 포인트) 님이 2016년 9월 29일 답변
감사합니다 좋은정보입니다 민물장어..
0 추천
margin padding 조절을 통해 그렇게 보이게 할 수는 있으나...

그냥 중앙 정렬이 가능한 ViewGroup으로 한번 더 감싸는게 편합니다.

// RelativeLayout => centerInParent or centerH/V

// LinearLayout => gravity center

그리고 sp(scale independent pixel)는 시스템의 폰트 크기 설정에 반응하도록 할 때 쓰는 크기단위입니다.

checkbox height에 sp가 쓰였네요.
칠리님 (10,910 포인트) 님이 2016년 9월 30일 답변
...