2012-03-20 53 views
1

我有一個AutoCompleTextView,爲此我創建了一個在TextView周圍創建一個漂亮邊框的形狀。在我的平板電腦上,我可以看到邊框。有了相同的配置,我無法在手機上看到它。所以......我錯過了什麼?形狀未顯示

這裏是我的AutoCompleteTextView:

<AutoCompleteTextView 
     android:id='@+id/search' 
     android:layout_height='wrap_content' 
     android:layout_width='fill_parent' 
     android:layout_toRightOf="@id/search_picture" 
     android:layout_margin="10dp" 
     android:padding="5dp" 
     android:completionThreshold="1" 
     android:background="@drawable/back" 
     android:hint="search..." 
     xmlns:android='http://schemas.android.com/apk/res/android'> 
    </AutoCompleteTextView> 

而這裏的形狀back.xml:

<shape xmlns:android="http://schemas.android.com/apk/res/android" 
     android:shape="rectangle" > 
    <solid android:color="#ffffff" /> 
    <stroke android:width="2dp" android:color="@color/blue"/> 
    <padding android:left="2dp" android:top="2dp" android:right="2dp" android:bottom="2dp" /> 
</shape> 

我發現形狀#2,通常完美的作品。

感謝您的任何提示!

回答

0

//如果您取下'符號,這將很好地工作,並把 「」

<AutoCompleteTextView 
     android:id="@+id/search" 
     android:layout_height="wrap_content" 
     android:layout_width="fill_parent" 
     android:layout_toRightOf="@id/search_picture" 
     android:layout_margin="10dp" 
     android:padding="5dp" 
     android:completionThreshold="1" 
     android:background="@drawable/back" 
     android:hint="search..." 
     xmlns:android="http://schemas.android.com/apk/res/android"> 
    </AutoCompleteTextView> 

//我的htc野火2.3看起來好像沒什麼

enter image description here

//其實我當我使用線性佈局時,刪除了線android:layout_toRightOf="@id/search_picture"

+0

謝謝。我替換了角色。它仍然不起作用,在平板電腦上照常工作。所以這個錯誤必須在別的地方... – Marco 2012-03-20 17:03:50

+0

增加筆畫的寬度來檢查。並刪除填充也。 – 2012-03-20 17:08:10

+0

我也試過。仍然沒有顯示。 – Marco 2012-03-22 09:39:50

0

解決了這個問題!

我使用主題。我定義:

<item name='android:windowBackground'>@color/transparent</item> 

顯然,這是問題的原因。我刪除了這個,現在它工作得很好。我不清楚如何,但嘿...它的作品。