2014-12-08 2 views
0

그림을 사용하지 않고 원 안에 문자로 된 버튼을 만들고 싶습니다.배경 프로그램 가능한 드로어 블 자르기가

내 버튼을 다음과 같이 정의된다 :

<Button 
    android:id="@+id/zoomInButton" 
    android:layout_width="40dp" 
    android:layout_height="40dp" 
    android:layout_margin="10dp" 
    android:background="@drawable/circle" 
    android:text="+" 
    android:textColor="@color/white" 
    android:textSize="62sp" /> 

<Button 
    android:id="@+id/zoomOutButton" 
    android:layout_width="40dp" 
    android:layout_height="40dp" 
    android:layout_margin="10dp" 
    android:background="@drawable/circle" 
    android:text="-" 
    android:textColor="@color/white" 
    android:textSize="62sp" /> 

그리고 원의 존재로 :

<?xml version="1.0" encoding="utf-8"?> 
<shape xmlns:android="http://schemas.android.com/apk/res/android" 
    android:shape="oval" > 

    <stroke 
     android:width="3dp" 
     android:color="@color/white" /> 

    <solid android:color="@android:color/transparent" /> 

</shape> 

그러나, 원 중앙에 있지 않고 텍스트가 잘립니다 :

bad circle

텍스트의 배경을 가운데에 배치하는 방법은 무엇입니까?

+0

시도해보십시오. 'textSize' (줄이자) – kId

+0

@kaushik 잘 작동 했으니 받아 들일 것입니다. 감사 – Antzi

답변

1

Buttons'textSize을 줄이기 위해 62sp에 텍스트가 잘리는 이유가 충분하지 않기 때문에이 문제를 해결하십시오.