2015년 8월 7일 금요일

Buttons in button bars should be borderless 해결

오랜만에 Android Studio를 설치해서 예전에 만들어둔 project를 열어서 Analyze > InspectCode 를 수행하였습니다.
그랬더니 Android Lint 항목에 떠억하니 Button should be borderless 가 나오는데 경고가 뜨는 xml을 봐도 무슨말인지 몰라서 검색을 해봤습니다.


<Button
    android:id="@+id/buttonSave"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:text="@string/save"
    />


오류 내용
버튼은 경계선이 없어야 한다고 하네요. 검색해본 결과 의견이 분분합니다.
stackoverflow에서도 누가질문을 했네요.
http://stackoverflow.com/questions/16648768/why-buttons-in-button-bars-should-be-borderless-in-android-api-level-15
아래 링크를 보면 중간쯤 부터 Do, Don't 내용이 나오는데 Don't 쪽이 서로 서로 장단점이 있는것 같은데 이유를 모르겠습니다.
developer.android.com/design/building-blocks/buttons.html

해결방법은 무시하거나 아래 코드를 추가하면 됩니다.
style="?android:attr/borderlessButtonStyle" 
개선 코드

<Button
    android:id="@+id/buttonSave"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:text="@string/save"
    style="?android:attr/borderlessButtonStyle"
    />




댓글 없음:

댓글 쓰기