0

アプリで次のような検索ボックスを設計したいと考えています。
検索アイコン

クリックすると、次のように展開されます。

検索ボックス

しかし、これを達成する方法がわかりません。

4

4 に答える 4

1

RelativeLayoutImageView align_parent_top & align_parent_right を使用して設定する必要があります。使用する場合は、LinearLayout次の方法で試すことができます:---

<LinearLayout
    android:id="@+id/ll_my_profile"
    android:layout_width="fill_parent"
    android:layout_height="45dp"
    android:layout_marginLeft="10dp"
     android:clickable="true"
    android:layout_marginRight="10dp"
    android:background="@drawable/txt_box_bg"
    android:orientation="horizontal" >

    <TextView
        android:id="@+id/my_profile"
        android:layout_width="0dip"
        android:layout_height="45dp"
        android:layout_weight="1"
        android:gravity="left"
        android:hint="My Profile"
        android:padding="10dp"
        android:textColor="#000000"
        android:textSize="18dp" />

    <ImageView
        android:id="@+id/img_for_setting"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_gravity="right|center_vertical"
        android:background="@drawable/arrow" />
</LinearLayout>
于 2012-12-17T08:54:27.760 に答える
0

モバイル Jquery ユーティリティを試しましたか? これを達成するのは難しくありません。

于 2012-12-17T08:52:31.787 に答える
0

アプリでの検索ボックスの使用方法によっては、 ActionBar でアクション ビューを使用するのが最適な場合があります。これは、拡張可能で応答性の高い検索ボックスをアクティビティに含めるために Google が推奨する方法です。

SDK 11 より前の Android バージョンでは、互換性ライブラリActionBarSherlockを使用して同じ機能をすべて実現できます。私自身は ActionBarSherlock で拡張可能な検索バーを使用したことはありませんが、ここでは SearchView を使用して可能であるように見えます。

それが役立つことを願っています!

于 2012-12-17T09:05:09.703 に答える
0

線形レイアウトを作成します。その背景を完全な編集ボックスの画像として設定します。その線形レイアウト内に、1 つの編集ボックスとボタンを追加します。ボタンの背景を android:background="@drawable/searchbtn" として設定します。エディットボックスの背景を無画像(透過画像)に設定して完了です。

于 2012-12-17T09:05:47.900 に答える