0

数字のテキストボックスを許可するデフォルトのビューはありますか?テキストボックスを入力するか、テキストボックスで2つの隣接するノブを使用して変更できます。だから、基本的には、驚くばかりのASCIIグラフィックスで:基本的にデフォルトのAndroidビューウィジェットには、テキストボックスと2つのノブがありますか?

[<] [テキストボックス] [>]

インクリメントボタン、テキストボックス、および減少ボタン。

+0

はなしSDKに組み込まれたものがない場合の例を見つけることができるドキュメントhere

を見つけることができます。 – Mayank

+2

いいえ、SDKにはありません。しかし、あなたはテキストビューと2つのボタンから自分自身を作成し​​、再利用できるようにすることができます。 –

答えて

0

が、あなたは今NumberPickerを使用することができます。

あなたはhere

+0

デフォルトのNumberPickerは、問題で説明されているように、水平ではなく垂直のみです。 –

0

私のEditTextを使用してカスタムソリューションと2つのButtonオブジェクト:APIレベル11以降

// This is a textbox group with two knob buttons 
    LinearLayout boxGroup = new LinearLayout(this); 
    boxGroup.setOrientation(LinearLayout.HORIZONTAL); 

    //Stores the current value in the textbox 
    final int[] value = {0}; 

    // Editable text box 
    final EditText editText = new EditText(this); 
    editText.setText("" + value[0]); 

    // Decrement button 
    Button decrementButton = new Button(this); 
    decrementButton.setText("<"); 
    decrementButton.setOnClickListener(new View.OnClickListener() { 
     public void onClick(View v) { 
      value[0]++; 
      editText.setText("" + value[0]); 
     } 
    }); 

    // Increment button 
    Button incrementButton = new Button(this); 
    incrementButton.setText(">"); 
    incrementButton.setOnClickListener(new View.OnClickListener() { 
     public void onClick(View v) { 
      value[0]--; 
      editText.setText("" + value[0]); 
     } 
    }); 

    boxGroup.addView(decrementButton); 
    boxGroup.addView(editText); 
    boxGroup.addView(incrementButton); 
関連する問題