Commit f840c293 by 段启岩

修改搜索图标

parent 3a1e4d19
......@@ -15,37 +15,37 @@ import androidx.annotation.RequiresApi;
import cn.yunliyunwai.beyondclouds.R;
import cn.yunliyunwai.beyondclouds.databinding.BeyondSearchBarBinding;
public class SearchBar extends FrameLayout {
public class BeyondSearchBar extends FrameLayout {
BeyondSearchBarBinding binding;
private String searchInputHint;
public SearchBar(@NonNull Context context) {
public BeyondSearchBar(@NonNull Context context) {
super(context);
initView(context);
}
public SearchBar(@NonNull Context context, @Nullable AttributeSet attrs) {
public BeyondSearchBar(@NonNull Context context, @Nullable AttributeSet attrs) {
super(context, attrs);
initAttrs(context, attrs);
initView(context);
}
public SearchBar(@NonNull Context context, @Nullable AttributeSet attrs, int defStyleAttr) {
public BeyondSearchBar(@NonNull Context context, @Nullable AttributeSet attrs, int defStyleAttr) {
super(context, attrs, defStyleAttr);
initAttrs(context, attrs);
initView(context);
}
@RequiresApi(api = Build.VERSION_CODES.LOLLIPOP)
public SearchBar(@NonNull Context context, @Nullable AttributeSet attrs, int defStyleAttr, int defStyleRes) {
public BeyondSearchBar(@NonNull Context context, @Nullable AttributeSet attrs, int defStyleAttr, int defStyleRes) {
super(context, attrs, defStyleAttr, defStyleRes);
initAttrs(context, attrs);
initView(context);
}
private void initAttrs(Context context, AttributeSet attrs) {
TypedArray typedArray = context.obtainStyledAttributes(attrs, R.styleable.SearchBar);
searchInputHint = typedArray.getString(R.styleable.SearchBar_search_input_hint);
TypedArray typedArray = context.obtainStyledAttributes(attrs, R.styleable.BeyondSearchBar);
searchInputHint = typedArray.getString(R.styleable.BeyondSearchBar_search_input_hint);
}
private void initView(Context context) {
......
......@@ -16,12 +16,12 @@
android:layout_marginEnd="12dp"
android:layout_marginRight="12dp"
android:background="#efefef" />
<ImageView
<ImageButton
android:id="@+id/search_icon_search"
app:layout_constraintTop_toTopOf="@id/search_bar_to_border"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toStartOf="parent"
android:src="@color/colorPrimary"
android:background="@drawable/icon_search"
android:layout_marginStart="20dp"
android:layout_marginLeft="20dp"
android:layout_width="16dp"
......@@ -39,12 +39,12 @@
android:layout_width="0dp"
android:layout_height="39dp" />
<ImageView
<ImageButton
android:id="@+id/search_icon_add"
app:layout_constraintTop_toTopOf="@id/search_bar_to_border"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
android:src="@color/colorPrimary"
android:background="@drawable/icon_add"
android:layout_marginEnd="14dp"
android:layout_marginRight="14dp"
android:layout_width="16dp"
......
......@@ -19,7 +19,7 @@
app:layout_constraintEnd_toEndOf="parent"
android:layout_width="match_parent"
android:layout_height="50dp" />
<cn.yunliyunwai.beyondclouds.view.SearchBar
<cn.yunliyunwai.beyondclouds.view.BeyondSearchBar
android:id="@+id/search_bar"
app:layout_constraintTop_toBottomOf="@id/magic_indicator"
app:search_input_hint="搜索博客/用户"
......
<?xml version="1.0" encoding="utf-8"?>
<resources>
<declare-styleable name="SearchBar">
<declare-styleable name="BeyondSearchBar">
<attr name="search_input_hint" format="string" />
</declare-styleable>
<declare-styleable name="BeyondIcon">
<attr name="name" format="string" />
</declare-styleable>
</resources>
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment