2012-03-28 5 views
1

Androidアプリケーションを開発しているうちに、わずらわしい問題が発生しました。私が作成しているUI要素は、カスタム検索フィールドを持つヘッダーバーです。 AndroidのUIエディタではすばらしく見えますが、もう1つはエミュレータまたはデバッガを使って虫眼鏡の画像を圧縮し、編集テキストをクリップします。私は現在、親LinearLayoutにあるカスタム検索フィールドに検索エリアの背景イメージを変更することを含む多くのことを試みました。これにより、検索フィールドのサイズが制御不能になります。Android UIエディタ/ディスプレイバグ

ご提案は大歓迎です。

私の質問は次のとおりです。
1)検索領域の外観を維持しながら、この問題をどのように修正しますか?
2)この問題が発生するのはなぜですか?これは、UIエディタのスクリーンショットです
サムスンギャラクシーネクサス4.0.2
モトローラズーム4.0.3
ネクサスS 2.3.7


This is a screenshot of the UI editor

次のデバイス上で確認

これは、テストしたすべてのデバイスでどのように見えるのスクリーンショットです:
This is a screenshot of what it looks like on all devices tested

これらのUI要素を生成するために使用されるXML:

<?xml version="1.0" encoding="utf-8"?> 
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" 
android:id="@+id/header" 
android:layout_width="fill_parent" 
android:layout_height="wrap_content" 
android:background="@drawable/title_bar_matte" 
android:gravity="center_vertical" 
android:orientation="horizontal" > 

<LinearLayout 
    android:layout_width="0dp" 
    android:layout_height="fill_parent" 
    android:layout_margin="10dp" 
    android:layout_weight="1.0" 
    android:background="@drawable/search_field" 
    android:gravity="center_vertical" 
    android:orientation="horizontal" > 

    <ImageView 
     android:layout_width="wrap_content" 
     android:layout_height="fill_parent" 
     android:layout_marginLeft="15dp" 
     android:src="@drawable/magnifying_glass" /> 


    <EditText 
     android:id="@+id/campus_map_acitivity_search" 
     android:layout_width="0dp" 
     android:layout_height="fill_parent" 
     android:layout_marginLeft="10dp" 
     android:layout_weight="1.0" 
     android:background="#0FFF" 
     android:hint="Search" 
     android:imeOptions="actionSearch" 
     android:singleLine="true" /> 
</LinearLayout> 

<Button 
    android:id="@+id/campus_map_activity_goto_list" 
    android:layout_width="wrap_content" 
    android:layout_height="wrap_content" 
    android:layout_marginLeft="5dp" 
    android:background="@drawable/button_list" /> 

<Button 
    android:id="@+id/campus_map_activity_my_location" 
    android:layout_width="wrap_content" 
    android:layout_height="wrap_content" 
    android:layout_marginLeft="5dp" 
    android:layout_marginRight="5dp" 
    android:background="@drawable/button_location" /> 

</LinearLayout> 

答えて

2

だけで問題を考え出しました。検索背景画像の上端と左端は9パッチスケールに設定されています。これはすべてうまくいきましたが、コンテンツが存在する余地があるように、下部と右の塗りつぶし領域を設定するのを忘れてしまいました。

http://radleymarx.com/blog/simple-guide-to-9-patch/

塗りつぶし領域を設定することを忘れないでください!

AndroidのUIエディタでは、デバイスのように9パッチの画像は処理されません。それは私のバグだと思う。