2017-10-17 119 views
0

我有一个timepicker,一切正常,但问题是,我不能使它看起来像设计者希望。现在它看起来像这样: screenshot如何在TimePicker关闭键盘图标?

我需要隐藏按钮下的这个键盘图标。我该怎么做?这只是一个原型,所以这里只是它的XML:

<?xml version="1.0" encoding="utf-8"?> 
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" 
    android:layout_width="match_parent" 
    android:layout_height="match_parent" 
    android:orientation="vertical" 
    android:tag="ww"> 

    <TextView 
    android:id="@+id/textView" 
    android:layout_width="wrap_content" 
    android:layout_height="wrap_content" 
    android:text="Time" 
    android:textAppearance="?android:attr/textAppearanceLarge" /> 

    <TimePicker 
    android:id="@+id/timePicker" 
    android:layout_width="wrap_content" 
    android:layout_height="wrap_content" 
    android:amPmBackgroundColor="#6400AA" 
    android:numbersSelectorColor="#6400AA" /> 

    <LinearLayout 
    android:layout_width="wrap_content" 
    android:layout_height="wrap_content" 
    android:layout_gravity="end" 
    android:orientation="horizontal"> 

    <Button 
     android:id="@+id/button2" 
     android:layout_width="match_parent" 
     android:layout_height="wrap_content" 
     android:text="Cancel" 
     android:textColor="#6400AA" /> 

    <Button 
     android:id="@+id/button1" 
     android:layout_width="match_parent" 
     android:layout_height="wrap_content" 
     android:text="OK" 
     android:textColor="#6400AA" /> 

    </LinearLayout> 

</LinearLayout> 
+0

改变它,我不相信你可以删除图标,它是在AndroidØ – tyczj

+0

@tyczj我可能会改变它在Android的早期版本的用户界面的一部分?说它5.1 – VolodymyrH

+1

这图标是不存在于以前的版本,它的存在使当时的手工编辑更加明显,你可以随时点击时间,并改变它,但它wasnt明显的,你能做到这一点 – tyczj

回答

1

至于我可以告诉你不能删除这个图标,它是在Android O.

的图标UI的部分有使当时的手工编辑更加明显,因为在以前的版本中,它是不是很明显,你可以点击时间,并通过键盘

0

尝试使用:

timePicker.setDescendantFocusability(TimePicker.FOCUS_BLOCK_DESCENDANTS); 

您也可以在XML中使用android:descendantFocusability="blocksDescendants"

+0

这是行不通的。 – VolodymyrH