2010-07-22 5 views
12

Android에서 NumericUpDown 버튼을 찾으려고했지만 실패했습니다. 안드로이드에서 컨트롤러가 호출되는 것을 알고 있습니까? 알려주세요! 시간에 대한NumericUpDown 버튼이있는 Android?

<?xml version="1.0" encoding="utf-8"?> 
<!-- 
main.xml 
7/22 2010 
--> 
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" 
android:layout_width="fill_parent" 
android:layout_height="fill_parent" 
> 
<GridView 
    android:id="@+id/GridView" 
    android:layout_width="fill_parent" 
    android:layout_height="fill_parent" 
    android:numColumns="3" 
    android:verticalSpacing="10dp" 
    android:horizontalSpacing="10dp" 
    android:columnWidth="90dp" 
    android:stretchMode="columnWidth" 
    android:gravity="center" 
    android:background="@color/white" 
    > 
</GridView> 
<ButtonUpDown> 
    <!-- The real name is??? --> 
</ButtonUpDown> 
</LinearLayout> 

고맙습니다 편집 :

컨트롤러는 다음과 같습니다 android number picker을 검색 Numeric up down http://www.skogberg.eu/img/numUpDown.png

답변

21

스크린 샷에있는보기는 DatePicker과 같은 표준 구성 요소 중 일부에서 사용되는 com.android.iternal.widget.NumberPicker처럼 보입니다.

이 구성 요소는 공개용으로 사용되지 않으므로 패키지 이름에 internal이 있어야합니다. some tricks you can use to get to it이 있지만 직접 액세스하지 말 것을 권합니다. 이것은 "비공개"코드이므로 API 유지 관리자는 여러 버전의 Android에서 외부 호환성에 대해 걱정할 필요가 없으므로 지금 작동하게해도 향후에 문제가 발생할 수 있습니다.

최상의 선택은 get the code for NumberPicker from the public Android source repository이며, 그것을 자신의 클래스에 잘라내어 붙여 넣어 숫자 선택기 위젯을 만드십시오.

또는 직접하지 않으려는 경우 the work to pull NumberPicker from the source has already been done and posted on a website for you to download and use.

+2

아무도 안드로이드 팀에 패치를 제출는 아직 공식적으로이 작업을 수행하는? 그렇지 않다면 누군가도 그렇게해야하므로 미래 개발자는이 질문을하지 않아도됩니다. –

1

특히 this threadcom.android.internal.widget.NumberPicker가 제안하는 몇 가지 좋은 결과를 내놓았다 날짜 선택 도구로 사용되는 항목. 스레드는 사용/에뮬레이션에 대한 몇 가지 제안 사항이 있습니다.

3

이 오래된 질문이다,하지만 난 경우 다른 사람이 게시 할 예정이 게시물을 발견 :

언급 한 바와 같이

, NumberPicker 내부가 아닌 공공 사용할 수 있습니다. 안드로이드 소스에서 소스 코드를 복사하는 가장 안전한 방법. 누군가가 이미를했고, 여기에 게시 :

http://www.quietlycoding.com/?p=5

또한 동일한 주제에 대한 토론을 위해 this를 참조하십시오.

1
<android.widget.NumberPicker 
    android:id="@+id/numberPicker1" 
    android:layout_width="wrap_content" 
    android:layout_height="wrap_content" > 
</android.widget.NumberPicker>