如何在android中的daimajia sliderlayout中点击搜索框和通知铃声

时间:2016-11-30 06:25:04

标签: android

search bax click

在上面这张图片中有一个搜索框和一个图像视图(用于通知)。我们在daimajia滑块布局中都有,我想在sliderlayout.our搜索框中点击搜索框和铃声图像,在slidelayout中点击铃声。

      <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
                    xmlns:custom="http://schemas.android.com/apk/res-auto"
                    android:layout_width="match_parent"
                    android:layout_height="match_parent">

                    <com.daimajia.slider.library.SliderLayout
                        android:id="@+id/slider"
                        android:layout_width="match_parent"
                        android:layout_height="match_parent"
                        android:layout_alignParentTop="true"
                        custom:auto_cycle="true"
                        custom:indicator_visibility="visible"
                        custom:pager_animation="Accordion"
                        custom:pager_animation_span="1100">

                        <LinearLayout
                            android:layout_width="match_parent"
                            android:layout_height="wrap_content"
                            android:layout_alignParentTop="true"
                            android:layout_centerHorizontal="true"
                            android:clickable="true"
                            android:gravity="center"
                            android:orientation="horizontal">

                            <LinearLayout
                                android:id="@+id/layout_search"
                                android:layout_width="match_parent"
                                android:layout_height="30dp"
                                android:layout_marginLeft="20dp"
                                android:layout_weight="1"
                                android:background="@drawable/edit_search_friend"
                                android:clickable="true"
                                android:gravity="center">

                                <ImageView
                                    android:layout_width="18dp"
                                    android:layout_height="18dp"
                                    android:src="@drawable/search_icon_black" />

                                <TextView
                                    android:id="@+id/frnd_search"
                                    android:layout_width="wrap_content"
                                    android:layout_height="30dp"
                                    android:background="@null"
                                    android:gravity="center"
                                    android:hint="Search Store"
                                    android:singleLine="true"
                                    android:textColor="#010101"
                                    android:textColorHint="#010101"
                                    android:textSize="14sp" />
                            </LinearLayout>

                            <RelativeLayout
                                android:id="@+id/layout_notification"
                                android:layout_width="wrap_content"
                                android:layout_height="wrap_content"
                                android:layout_marginLeft="5dp"
                                android:layout_marginRight="10dp"
                                android:layout_weight="0">

                                <ImageView
                                    android:id="@+id/imageView_notification"
                                    android:layout_width="50dp"
                                    android:layout_height="50dp"
                                    android:padding="7dp"
                                    android:src="@drawable/bell_noti_black" />

                                <TextView
                                    android:id="@+id/textView_notification_count_value"
                                    android:layout_width="20dp"
                                    android:layout_height="20dp"
                                    android:layout_alignRight="@+id/img_noti"
                                    android:layout_marginLeft="30dp"
                                    android:layout_marginTop="10dp"
                                    android:background="@drawable/red_circle_show_noti"
                                    android:gravity="center"
                                    android:text="20"
                                    android:textColor="@android:color/white"
                                    android:textSize="12sp"
                                    android:textStyle="bold"
                                    android:visibility="gone"/>

                            </RelativeLayout>
                        </LinearLayout>

                    </com.daimajia.slider.library.SliderLayout>

                    <com.daimajia.slider.library.Indicators.PagerIndicator
                        android:id="@+id/custom_indicator"
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:layout_alignParentBottom="true"
                        android:layout_centerHorizontal="true"
                        android:layout_marginBottom="20dp"
                        android:gravity="center"
                        custom:selected_color="#0095BF"
                        custom:selected_drawable="@drawable/bird"
                        custom:selected_height="6dp"
                        custom:selected_padding_left="5dp"
                        custom:selected_padding_right="5dp"
                        custom:selected_width="6dp"
                        custom:shape="oval"
                        custom:unselected_color="#55333333"
                        custom:unselected_height="6dp"
                        custom:unselected_padding_left="5dp"
                        custom:unselected_padding_right="5dp"
                        custom:unselected_width="6dp" />

                    <com.daimajia.slider.library.Indicators.PagerIndicator
                        android:id="@+id/custom_indicator2"
                        style="@style/AndroidImageSlider_Corner_Oval_Orange"
                        android:layout_alignParentBottom="true"
                        android:layout_centerHorizontal="true"
                        android:layout_marginBottom="20dp" />

                </RelativeLayout>

1 个答案:

答案 0 :(得分:0)

将此代码添加到searchView

searchView.bringToFront();