[英]Custom looking searchView android
您可以通過多種方式獲得想要的設計信息。
我使用的解決方案(可能不是最好的)是將EditText(您的搜索字段)放在FrameLayout中,這樣我可以有一個搜索按鈕,並刪除與textView重疊的文本按鈕:
XML范例:
<FrameLayout
android:id="@+id/SearchTextInputLayout"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_gravity="center"
android:minWidth="100.0dp">
<EditText
android:id="@+id/SearchTextInput"
android:textColorHint="@layout/inputselector"
android:hint="Search terms here..."
android:textAppearance="?android:attr/textAppearanceMedium"
android:layout_width="match_parent"
android:layout_height="match_parent"
/>
<Button
android:id="@+id/ClearSearchButton"
android:layout_width="25dp"
android:layout_height="25dp"
android:layout_marginEnd="10dp"
android:layout_marginRight="10dp"
android:layout_gravity="end|center_vertical"
android:background="@android:drawable/ic_delete" />
</FrameLayout>
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.