検索レイアウトがあります。名前はsearch_holder.xml
です。検索アイコン、入力用の編集テキスト、入力を消去するXアイコンを含む水平線形レイアウトです。リニアレイアウトの背景が子フォーカスで一度消える
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/parent"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:background="@drawable/button_search_images"
android:orientation="horizontal"
android:padding="@dimen/tick_icon_distance">
<ImageView
android:id="@+id/search_icon"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_marginRight="-5dp"
android:padding="@dimen/tick_icon_distance"
android:layout_marginLeft="-5dp"
android:src="@drawable/ic_search" />
<EditText
android:id="@+id/search_field"
android:layout_width="@dimen/search_width"
android:layout_height="wrap_content"
android:background="@color/transparent"
android:hint="@string/search_google_images_hint"
android:inputType="text"
android:padding="5dp"
android:textSize="@dimen/search_text_size" />
<ImageView
android:id="@+id/btnClear"
android:visibility="gone"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:paddingBottom="@dimen/tick_icon_distance"
android:paddingTop="@dimen/tick_icon_distance"
android:src="@drawable/ic_x" />
</LinearLayout>
それから別のレイアウトに含める:
<include android:id="@+id/search_block"
android:layout_height="wrap_content"
android:layout_width="wrap_content"
android:layout_marginRight="@dimen/normal_right_margin"
layout="@layout/search_holder"
/>
問題は、私は初めてのEditTextをタップしたときに発生します。線形レイアウトの背景が消えます(透明になりました)。
その後、私が外にタップすると、背景が戻ってきました。 edittextをもう一度クリックすると、何も起こりません。アクティビティが最初に作成されるときにのみ発生します。
この問題は、API 21以下で発生します。
ハードウェアアクセラレータを有効/無効にしようとしましたが、役に立たないでしょう。
私はそれがバージョンかどうかわからない、または私は下位バージョンのために何かを逃している。
ありがとうございます。 (レイアウトを含む)を
EDIT:
<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/root"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_gravity="left"
tools:context=".MyActivity" >
<FrameLayout
android:layout_width="match_parent"
android:layout_height="match_parent" >
<!--Custom ImageView for drawing multiple drawable to canvas-->
<MyCustomImageView
android:id="@+id/editorImageView"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:clipChildren="true"
android:scaleType="fitXY" />
<!--This is for a frame on top of the CustomImageView-->
<ImageView
android:id="@+id/frame"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:clickable="false" />
<!-- Tools Layouts - The container of the tool set on top -->
<RelativeLayout
android:id="@+id/vb_action_bar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentTop="true"
android:background="@drawable/top_icons_shadow" >
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_marginTop="@dimen/small_top_margin"
android:gravity="center_vertical"
android:orientation="horizontal"
android:visibility="visible" >
<!-- The included layout here -->
<include android:id="@+id/search_block"
android:layout_height="wrap_content"
android:layout_width="wrap_content"
android:layout_marginRight="@dimen/normal_right_margin"
layout="@layout/search_holder"
/>
<!-- A few more button in the tool set -->
<ImageView
android:id="@+id/btn1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginRight="@dimen/normal_right_margin"
android:background="@drawable/icon1" />
<ImageView
android:id="@+id/btn2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginRight="@dimen/normal_right_margin"
android:background="@drawable/btn2" />
<ImageView
android:id="@+id/btn3"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginRight="@dimen/normal_right_margin"
android:background="@drawable/btn3" />
<ImageView
android:id="@+id/btn4"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginRight="@dimen/small_top_margin"
android:background="@drawable/btn4" />
</LinearLayout>
<!-- A top left menu button -->
<Button
android:id="@+id/slideMenu"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_alignParentTop="true"
android:layout_marginLeft="@dimen/xsmall_bottom_margin"
android:layout_marginTop="@dimen/xsmall_bottom_margin"
android:background="@android:color/transparent" />
</RelativeLayout>
注:このレイアウトは、風景モードである
あなたはsearch_holderレイアウトを含むレイアウトxmlを投稿できますか? – FAT
編集した質問を確認してください。ありがとうございました。 –