FAQ_15_android Imageview ImageButton Button

本文探讨了在UI设计中实现按钮按动效果的步骤,包括使用背景属性代替源属性,确保不同分辨率设备上的显示效果一致,并提供了解决在实际应用中遇到的问题的方法。

为了提高用户体验,我们必须在 ui 设计上花一些功夫。

比如说可以为按钮设置有按动的效果,那麽我们需要为其准备图片,还要考虑各个像素的手机的显示效果。


最近,做一个项目,需要用到 ImageView 并且点击该控件的时候,可以给用户有按下的感觉。


于是,我为其设置:

android:src="@drawable/iview_selector"
其中,iview_selector是drawable 下面的 xml 文件。


运行之后,没有任何效果。最后查看 api 发现,必须设置其为 background 属性:

android:background="@drawable/iview_selector"
Button、ImageView 设置 background 属性才可以让 selector 起作用,而 ImageButton 需要为其设置 src 属性。


关于如何设置selector 可以自行看 sdk 的 api。


小结。


修改后如下:<?xml version="1.0" encoding="utf-8"?> <androidx.coordinatorlayout.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto" android:layout_width="match_parent" android:layout_height="match_parent" android:background="@color/background_gray"> <!-- 颜色层--> <View android:id="@+id/colorOverlay" android:layout_width="match_parent" android:layout_height="match_parent" /> <!--遮罩层--> <View android:id="@+id/cover_view" android:layout_width="match_parent" android:layout_height="match_parent" android:alpha="0.3" android:background="@color/black" /> <!--背景底色(最底层)--> <ImageView android:layout_width="match_parent" android:layout_height="match_parent" android:scaleType="centerCrop" android:src="@drawable/background" android:visibility="visible" /> <ImageView android:id="@+id/switch_off_background" android:layout_width="match_parent" android:layout_height="match_parent" android:scaleType="centerCrop" android:src="@drawable/switchoffbgd"/> <!-- 顶部杂项--> <ImageView android:layout_width="match_parent" android:layout_height="match_parent" android:scaleType="centerCrop" android:src="@drawable/background" android:visibility="visible" app:layout_anchor="@+id/colorOverlay" app:layout_anchorGravity="center" /> <ImageButton android:layout_width="24dp" android:layout_height="24dp" android:layout_margin="16dp" android:background="@android:color/transparent" android:scaleType="centerCrop" android:src="@drawable/back" /> <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_gravity="center_horizontal" android:layout_marginTop="16dp" android:text="Smart Lamp" android:textSize="18.4dp" /> <LinearLayout android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_gravity="center_horizontal" android:layout_marginTop="46.5dp" > <ImageView android:layout_width="16dp" android:layout_height="16dp" android:layout_gravity="center_vertical" android:src="@drawable/location" /> <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginStart="4dp" android:text="Bedroom" android:textSize="16dp" /> </LinearLayout> <ImageButton android:layout_width="24dp" android:layout_height="24dp" android:layout_gravity="end" android:layout_margin="16dp" android:background="@android:color/transparent" android:scaleType="fitCenter" android:src="@drawable/setting" /> <!--按钮组--> <LinearLayout android:id="@+id/button_group" android:layout_width="370dp" android:layout_height="39dp" android:layout_gravity="center_horizontal" android:layout_marginTop="89dp" android:orientation="horizontal" android:paddingStart="22dp" android:paddingEnd="22dp"> <!-- Auto 按钮 --> <FrameLayout android:layout_width="39dp" android:layout_height="39dp" android:tag="button_container"> <com.google.android.material.button.MaterialButton android:id="@+id/button_auto" android:layout_width="36dp" android:layout_height="35dp" android:layout_gravity="center" android:backgroundTint="@color/white" android:insetTop="0dp" android:insetBottom="0dp" app:cornerRadius="17.5dp" app:rippleColor="@android:color/transparent" app:strokeColor="@android:color/darker_gray" app:strokeWidth="1dp" /> <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_gravity="center" android:text="Auto" android:textSize="13dp" /> </FrameLayout> <!-- White 按钮 --> <FrameLayout android:layout_width="39dp" android:layout_height="39dp" android:layout_marginStart="18.4dp" android:tag="button_container"> <com.google.android.material.button.MaterialButton android:id="@+id/button_white" android:layout_width="35dp" android:layout_height="35dp" android:layout_gravity="center" android:backgroundTint="@color/white" android:insetTop="0dp" android:insetBottom="0dp" app:cornerRadius="17.5dp" app:rippleColor="@android:color/transparent" app:strokeColor="@android:color/darker_gray" app:strokeWidth="1dp" /> <ImageView android:id="@+id/editicon_white" android:layout_width="24dp" android:layout_height="24dp" android:layout_gravity="center" android:src="@drawable/edit" android:visibility="gone" /> <View android:id="@+id/ring_white" android:layout_width="39dp" android:layout_height="39dp" android:layout_gravity="center" android:background="@drawable/ring_white" android:visibility="gone" /> </FrameLayout> <!-- Orange 按钮 --> <FrameLayout android:layout_width="39dp" android:layout_height="39dp" android:layout_marginStart="18.4dp" android:tag="button_container"> <com.google.android.material.button.MaterialButton android:id="@+id/button_orange" android:layout_width="35dp" android:layout_height="35dp" android:layout_gravity="center" android:backgroundTint="@color/orange" android:insetTop="0dp" android:insetBottom="0dp" app:cornerRadius="17.5dp" app:rippleColor="@android:color/transparent" app:strokeColor="@android:color/white" app:strokeWidth="1dp" /> <ImageView android:id="@+id/editicon_orange" android:layout_width="24dp" android:layout_height="24dp" android:layout_gravity="center" android:src="@drawable/edit" android:visibility="gone" /> <View android:id="@+id/ring_orange" android:layout_width="39dp" android:layout_height="39dp" android:layout_gravity="center" android:background="@drawable/ring_white" android:visibility="gone" /> </FrameLayout> <!-- Deep Blue 按钮 --> <FrameLayout android:layout_width="39dp" android:layout_height="39dp" android:layout_marginStart="18.4dp" android:tag="button_container"> <com.google.android.material.button.MaterialButton android:id="@+id/button_deepblue" android:layout_width="35dp" android:layout_height="35dp" android:layout_gravity="center" android:backgroundTint="@color/deepblue" android:insetTop="0dp" android:insetBottom="0dp" app:cornerRadius="17.5dp" app:rippleColor="@android:color/transparent" app:strokeColor="@android:color/white" app:strokeWidth="1dp" /> <ImageView android:id="@+id/editicon_deepblue" android:layout_width="24dp" android:layout_height="24dp" android:layout_gravity="center" android:src="@drawable/edit" android:visibility="gone" /> <View android:id="@+id/ring_deepblue" android:layout_width="39dp" android:layout_height="39dp" android:layout_gravity="center" android:background="@drawable/ring_white" android:visibility="gone" /> </FrameLayout> <!-- Sky Blue 按钮 --> <FrameLayout android:layout_width="39dp" android:layout_height="39dp" android:layout_marginStart="18.4dp" android:tag="button_container"> <com.google.android.material.button.MaterialButton android:id="@+id/button_skyblue" android:layout_width="35dp" android:layout_height="35dp" android:layout_gravity="center" android:backgroundTint="@color/skyblue" android:insetTop="0dp" android:insetBottom="0dp" app:cornerRadius="17.5dp" app:rippleColor="@android:color/transparent" app:strokeColor="@android:color/white" app:strokeWidth="1dp" /> <ImageView android:id="@+id/editicon_skyblue" android:layout_width="24dp" android:layout_height="24dp" android:layout_gravity="center" android:src="@drawable/edit" android:visibility="gone" /> <View android:id="@+id/ring_skyblue" android:layout_width="39dp" android:layout_height="39dp" android:layout_gravity="center" android:background="@drawable/ring_white" android:visibility="gone" /> </FrameLayout> <!-- Flame Red 按钮 --> <FrameLayout android:layout_width="39dp" android:layout_height="39dp" android:layout_marginStart="18.4dp" android:tag="button_container"> <com.google.android.material.button.MaterialButton android:id="@+id/button_flamered" android:layout_width="35dp" android:layout_height="35dp" android:layout_gravity="center" android:backgroundTint="@color/flamered" android:insetTop="0dp" android:insetBottom="0dp" app:cornerRadius="17.5dp" app:rippleColor="@android:color/transparent" app:strokeColor="@android:color/white" app:strokeWidth="1dp" /> <ImageView android:id="@+id/editicon_flamered" android:layout_width="24dp" android:layout_height="24dp" android:layout_gravity="center" android:src="@drawable/edit" android:visibility="gone" /> <View android:id="@+id/ring_flamered" android:layout_width="39dp" android:layout_height="39dp" android:layout_gravity="center" android:background="@drawable/ring_white" android:visibility="gone" /> </FrameLayout> </LinearLayout> <!--灯泡背景--> <ImageView android:id="@+id/imageView" android:layout_width="180dp" android:layout_height="244dp" android:layout_gravity="center_horizontal" android:layout_marginTop="207dp" android:src="@drawable/bulbbottom" /> <!--滑动图层--> <ImageView android:id="@+id/lampImageView" android:layout_width="180dp" android:layout_height="244dp" android:layout_gravity="center_horizontal" android:layout_marginTop="190dp" android:adjustViewBounds="true" android:scaleType="centerInside" android:src="@drawable/clip_bulb" /> <TextView android:id="@+id/percentText" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_gravity="center_horizontal" android:layout_marginTop="167dp" android:text="0%" android:textColor="#000" android:textSize="18sp" /> <!--灯泡底座--> <ImageView android:id="@+id/bulb_on_bottom" android:layout_width="180dp" android:layout_height="658dp" android:layout_gravity="center_horizontal" android:scaleType="centerInside" android:src="@drawable/bulbonbottom" /> <!--开关按钮--> <ImageButton android:id="@+id/switch_button" android:layout_width="60dp" android:layout_height="60dp" android:layout_gravity="center_horizontal" android:layout_marginTop="476dp" android:background="@android:color/transparent" android:scaleType="centerInside" android:src="@drawable/switchselector" /> <!--隐藏栏开关--> <!-- <LinearLayout--> <!-- android:layout_width="match_parent"--> <!-- android:layout_height="wrap_content"--> <!-- android:layout_marginTop="60dp"--> <!-- android:gravity="center"--> <!-- android:orientation="vertical">--> <!-- <Button--> <!-- android:id="@+id/btn_bottom_sheet"--> <!-- android:layout_width="wrap_content"--> <!-- android:layout_height="wrap_content"--> <!-- android:layout_marginTop="32dp"--> <!-- android:text="BottomSheet"--> <!-- android:textAllCaps="false" />--> <!--隐藏toolbar--> <LinearLayout android:layout_width="match_parent" android:layout_height="wrap_content" app:behavior_peekHeight="130dp" app:layout_behavior="com.google.android.material.bottomsheet.BottomSheetBehavior" > <ScrollView android:layout_width="wrap_content" android:layout_height="wrap_content"> <LinearLayout android:id="@+id/ll_bottom_sheet" android:layout_width="match_parent" android:layout_height="wrap_content" android:orientation="vertical" > <ImageView android:id="@+id/pull" android:layout_width="match_parent" android:layout_height="30dp" android:background="@color/white" android:clickable="false" android:focusable="false" android:gravity="center" android:paddingTop="15dp" android:src="@drawable/pullselector" /> <LinearLayout android:layout_width="match_parent" android:layout_height="60dp" android:layout_gravity="center_horizontal" android:background="@color/white" android:paddingStart="10dp" android:paddingTop="10dp" android:paddingEnd="10dp" android:weightSum="4"> <ImageButton android:id="@+id/button_mode" android:layout_width="0dp" android:layout_height="60dp" android:layout_weight="1" android:background="@android:color/transparent" android:scaleType="centerInside" android:src="@drawable/mode" /> <ImageButton android:id="@+id/button_schedule" android:layout_width="0dp" android:layout_height="60dp" android:layout_weight="1" android:background="@android:color/transparent" android:scaleType="centerInside" android:src="@drawable/schedule" /> <ImageButton android:id="@+id/button_away" android:layout_width="0dp" android:layout_height="60dp" android:layout_weight="1" android:background="@android:color/transparent" android:scaleType="centerInside" android:src="@drawable/away" /> <ImageButton android:id="@+id/button_timer" android:layout_width="0dp" android:layout_height="60dp" android:layout_weight="1" android:background="@android:color/transparent" android:scaleType="centerInside" android:src="@drawable/timer" /> </LinearLayout> <LinearLayout android:layout_width="match_parent" android:layout_height="42dp" android:layout_gravity="center_horizontal" android:background="@color/white" android:paddingStart="10dp" android:paddingEnd="10dp" android:weightSum="4"> <TextView android:layout_width="0dp" android:layout_height="42dp" android:layout_weight="1" android:gravity="center" android:text="Mode" /> <TextView android:layout_width="0dp" android:layout_height="42dp" android:layout_weight="1" android:gravity="center" android:text="Schedule" /> <TextView android:layout_width="0dp" android:layout_height="42dp" android:layout_weight="1" android:gravity="center" android:text="Away" /> <TextView android:layout_width="0dp" android:layout_height="42dp" android:layout_weight="1" android:gravity="center" android:text="Timer" /> </LinearLayout> <View android:layout_width="match_parent" android:layout_height="10.5dp" android:background="@color/background_gray" /> <LinearLayout android:layout_width="match_parent" android:layout_height="wrap_content" android:background="@color/white"> <TextView android:layout_width="113dp" android:layout_height="41dp" android:gravity="center" android:text="Today" android:textColor="@color/text_gray" android:textSize="13dp" /> </LinearLayout> <LinearLayout android:layout_width="match_parent" android:layout_height="70dp" android:background="@color/white" android:paddingStart="35dp" android:paddingEnd="35dp" android:weightSum="3"> <LinearLayout android:layout_width="0dp" android:layout_height="wrap_content" android:layout_weight="1" android:background="@color/white" android:orientation="vertical"> <LinearLayout android:layout_width="wrap_content" android:layout_height="wrap_content"> <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="12.1" android:textSize="23dp" android:textStyle="bold" /> <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginStart="4dp" android:layout_weight="1" android:text="h" android:textSize="12dp" /> </LinearLayout> <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_gravity="top" android:text="Runtime" android:textColor="@color/text_gray" android:textSize="14dp" /> </LinearLayout> <LinearLayout android:layout_width="0dp" android:layout_height="wrap_content" android:layout_weight="1" android:background="@color/white" android:orientation="vertical"> <LinearLayout android:layout_width="wrap_content" android:layout_height="wrap_content"> <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="125.1" android:textSize="23dp" android:textStyle="bold" /> <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginStart="4dp" android:layout_weight="1" android:text="Kmh" android:textSize="12dp" /> </LinearLayout> <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_gravity="top" android:text="Usage" android:textColor="@color/text_gray" android:textSize="14dp" /> </LinearLayout> <LinearLayout android:layout_width="0dp" android:layout_height="wrap_content" android:layout_marginStart="11dp" android:layout_weight="1" android:background="@color/white" android:orientation="vertical"> <LinearLayout android:layout_width="wrap_content" android:layout_height="wrap_content"> <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="992.3" android:textSize="23dp" android:textStyle="bold" /> <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginStart="4dp" android:layout_weight="1" android:text="Kmh" android:textSize="12dp" /> </LinearLayout> <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_gravity="top" android:text="Saving" android:textColor="@color/text_gray" android:textSize="14dp" /> </LinearLayout> </LinearLayout> <View android:layout_width="match_parent" android:layout_height="10.5dp" android:background="@color/background_gray" /> <LinearLayout android:layout_width="match_parent" android:layout_height="56dp" android:background="@color/white" android:gravity="center_vertical" android:paddingLeft="20dp" android:paddingRight="20dp"> <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="Favorite" android:textSize="16dp" /> <!-- 占位 View,用来推动 ImageButton 到右边 --> <View android:layout_width="0dp" android:layout_height="0dp" android:layout_weight="1" /> <ImageButton android:id="@+id/button_favorite" android:layout_width="42dp" android:layout_height="28dp" android:background="@android:color/transparent" android:scaleType="centerInside" android:src="@drawable/favorite_on" /> </LinearLayout> <FrameLayout android:layout_width="match_parent" android:layout_height="wrap_content" android:background="@color/white"> <View android:layout_width="320dp" android:layout_height="0.2dp" android:layout_gravity="center_horizontal" android:background="@color/text_gray" /> </FrameLayout> <LinearLayout android:layout_width="match_parent" android:layout_height="56dp" android:background="@color/white" android:gravity="center_vertical" android:paddingLeft="20dp" android:paddingRight="20dp"> <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="Device Sharing" android:textSize="16dp" /> <!-- 占位 View,用来推动 ImageButton 到右边 --> <View android:layout_width="0dp" android:layout_height="0dp" android:layout_weight="1" /> <ImageView android:layout_width="16dp" android:layout_height="16dp" android:background="@android:color/transparent" android:scaleType="centerInside" android:src="@drawable/sharing" /> <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="2" android:textColor="@color/text_gray" /> <ImageButton android:layout_width="24dp" android:layout_height="24dp" android:background="@android:color/transparent" android:scaleType="centerInside" android:src="@drawable/more" /> </LinearLayout> <FrameLayout android:layout_width="match_parent" android:layout_height="wrap_content" android:background="@color/white"> <View android:layout_width="320dp" android:layout_height="0.2dp" android:layout_gravity="center_horizontal" android:background="@color/text_gray" /> </FrameLayout> <LinearLayout android:layout_width="match_parent" android:layout_height="56dp" android:background="@color/white" android:gravity="center_vertical" android:paddingLeft="20dp" android:paddingRight="20dp"> <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="FAQ & Feedback" android:textSize="16dp" /> <!-- 占位 View,用来推动 ImageButton 到右边 --> <View android:layout_width="0dp" android:layout_height="0dp" android:layout_weight="1" /> <ImageButton android:layout_width="24dp" android:layout_height="24dp" android:background="@android:color/transparent" android:scaleType="centerInside" android:src="@drawable/more" /> </LinearLayout> <FrameLayout android:layout_width="match_parent" android:layout_height="wrap_content" android:background="@color/white"> <View android:layout_width="320dp" android:layout_height="0.2dp" android:layout_gravity="center_horizontal" android:background="@color/text_gray" /> </FrameLayout> <View android:layout_width="match_parent" android:layout_height="280dp" android:background="@color/white" /> </LinearLayout> </ScrollView> </LinearLayout> </androidx.coordinatorlayout.widget.CoordinatorLayout>
08-22
<fragment android:id="@+id/nav_host_fragment" android:name="androidx.navigation.fragment.NavHostFragment" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_gravity="bottom" app:navGraph="@navigation/nav_graph" app:defaultNavHost="true" />如果放在<!--隐藏bottomsheet--> <LinearLayout android:id="@+id/ll_bottom_sheet" android:layout_width="match_parent" android:layout_height="wrap_content" app:behavior_peekHeight="105dp" app:layout_behavior="com.google.android.material.bottomsheet.BottomSheetBehavior" > <LinearLayout android:layout_width="match_parent" android:layout_height="wrap_content" android:orientation="vertical" > <ImageView android:id="@+id/pull" android:layout_width="match_parent" android:layout_height="30dp" android:background="@color/white" android:clickable="false" android:focusable="false" android:gravity="center" android:paddingTop="15dp" android:src="@drawable/pullselector" /> <LinearLayout android:layout_width="match_parent" android:layout_height="60dp" android:layout_gravity="center_horizontal" android:background="@color/white" android:paddingStart="10dp" android:paddingTop="10dp" android:paddingEnd="10dp" android:weightSum="4"> <ImageButton android:id="@+id/button_mode" android:layout_width="0dp" android:layout_height="60dp" android:layout_weight="1" android:background="@android:color/transparent" android:scaleType="centerInside" android:src="@drawable/mode" /> <ImageButton android:id="@+id/button_schedule" android:layout_width="0dp" android:layout_height="60dp" android:layout_weight="1" android:background="@android:color/transparent" android:scaleType="centerInside" android:src="@drawable/schedule" /> <ImageButton android:id="@+id/button_away" android:layout_width="0dp" android:layout_height="60dp" android:layout_weight="1" android:background="@android:color/transparent" android:scaleType="centerInside" android:src="@drawable/away" /> <ImageButton android:id="@+id/button_timer" android:layout_width="0dp" android:layout_height="60dp" android:layout_weight="1" android:background="@android:color/transparent" android:scaleType="centerInside" android:src="@drawable/timer" /> </LinearLayout> <LinearLayout android:layout_width="match_parent" android:layout_height="42dp" android:layout_gravity="center_horizontal" android:background="@color/white" android:paddingStart="10dp" android:paddingEnd="10dp" android:weightSum="4"> <TextView android:layout_width="0dp" android:layout_height="42dp" android:layout_weight="1" android:gravity="center" android:text="Mode" /> <TextView android:layout_width="0dp" android:layout_height="42dp" android:layout_weight="1" android:gravity="center" android:text="Schedule" /> <TextView android:layout_width="0dp" android:layout_height="42dp" android:layout_weight="1" android:gravity="center" android:text="Away" /> <TextView android:layout_width="0dp" android:layout_height="42dp" android:layout_weight="1" android:gravity="center" android:text="Timer" /> </LinearLayout> <ScrollView android:layout_width="wrap_content" android:layout_height="wrap_content"> <LinearLayout android:layout_width="match_parent" android:layout_height="wrap_content" android:orientation="vertical"> <View android:layout_width="match_parent" android:layout_height="10.5dp" android:background="@color/background_gray" /> <LinearLayout android:layout_width="match_parent" android:layout_height="wrap_content" android:background="@color/white"> <TextView android:layout_width="113dp" android:layout_height="41dp" android:gravity="center" android:text="Today" android:textColor="@color/text_gray" android:textSize="13dp" /> </LinearLayout> <LinearLayout android:layout_width="match_parent" android:layout_height="70dp" android:background="@color/white" android:paddingStart="35dp" android:paddingEnd="35dp" android:weightSum="3"> <LinearLayout android:layout_width="0dp" android:layout_height="wrap_content" android:layout_weight="1" android:background="@color/white" android:orientation="vertical"> <LinearLayout android:layout_width="wrap_content" android:layout_height="wrap_content"> <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="12.1" android:textSize="23dp" android:textStyle="bold" /> <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginStart="4dp" android:layout_weight="1" android:text="h" android:textSize="12dp" /> </LinearLayout> <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_gravity="top" android:text="Runtime" android:textColor="@color/text_gray" android:textSize="14dp" /> </LinearLayout> <LinearLayout android:layout_width="0dp" android:layout_height="wrap_content" android:layout_weight="1" android:background="@color/white" android:orientation="vertical"> <LinearLayout android:layout_width="wrap_content" android:layout_height="wrap_content"> <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="125.1" android:textSize="23dp" android:textStyle="bold" /> <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginStart="4dp" android:layout_weight="1" android:text="Kmh" android:textSize="12dp" /> </LinearLayout> <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_gravity="top" android:text="Usage" android:textColor="@color/text_gray" android:textSize="14dp" /> </LinearLayout> <LinearLayout android:layout_width="0dp" android:layout_height="wrap_content" android:layout_marginStart="11dp" android:layout_weight="1" android:background="@color/white" android:orientation="vertical"> <LinearLayout android:layout_width="wrap_content" android:layout_height="wrap_content"> <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="992.3" android:textSize="23dp" android:textStyle="bold" /> <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginStart="4dp" android:layout_weight="1" android:text="Kmh" android:textSize="12dp" /> </LinearLayout> <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_gravity="top" android:text="Saving" android:textColor="@color/text_gray" android:textSize="14dp" /> </LinearLayout> </LinearLayout> <View android:layout_width="match_parent" android:layout_height="10.5dp" android:background="@color/background_gray" /> <LinearLayout android:layout_width="match_parent" android:layout_height="56dp" android:background="@color/white" android:gravity="center_vertical" android:paddingLeft="20dp" android:paddingRight="20dp"> <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="Favorite" android:textSize="16dp" /> <!-- 占位 View,用来推动 ImageButton 到右边 --> <View android:layout_width="0dp" android:layout_height="0dp" android:layout_weight="1" /> <ImageButton android:id="@+id/button_favorite" android:layout_width="42dp" android:layout_height="28dp" android:background="@android:color/transparent" android:scaleType="centerInside" android:src="@drawable/favorite_on" /> </LinearLayout> <FrameLayout android:layout_width="match_parent" android:layout_height="wrap_content" android:background="@color/white"> <View android:layout_width="320dp" android:layout_height="0.2dp" android:layout_gravity="center_horizontal" android:background="@color/text_gray" /> </FrameLayout> <LinearLayout android:layout_width="match_parent" android:layout_height="56dp" android:background="@color/white" android:gravity="center_vertical" android:paddingLeft="20dp" android:paddingRight="20dp"> <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="Device Sharing" android:textSize="16dp" /> <!-- 占位 View,用来推动 ImageButton 到右边 --> <View android:layout_width="0dp" android:layout_height="0dp" android:layout_weight="1" /> <ImageView android:layout_width="16dp" android:layout_height="16dp" android:background="@android:color/transparent" android:scaleType="centerInside" android:src="@drawable/sharing" /> <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="2" android:textColor="@color/text_gray" /> <ImageButton android:layout_width="24dp" android:layout_height="24dp" android:background="@android:color/transparent" android:scaleType="centerInside" android:src="@drawable/more" /> </LinearLayout> <FrameLayout android:layout_width="match_parent" android:layout_height="wrap_content" android:background="@color/white"> <View android:layout_width="320dp" android:layout_height="0.2dp" android:layout_gravity="center_horizontal" android:background="@color/text_gray" /> </FrameLayout> <LinearLayout android:layout_width="match_parent" android:layout_height="56dp" android:background="@color/white" android:gravity="center_vertical" android:paddingLeft="20dp" android:paddingRight="20dp"> <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="FAQ & Feedback" android:textSize="16dp" /> <!-- 占位 View,用来推动 ImageButton 到右边 --> <View android:layout_width="0dp" android:layout_height="0dp" android:layout_weight="1" /> <ImageButton android:layout_width="24dp" android:layout_height="24dp" android:background="@android:color/transparent" android:scaleType="centerInside" android:src="@drawable/more" /> </LinearLayout> <FrameLayout android:layout_width="match_parent" android:layout_height="wrap_content" android:background="@color/white"> <View android:layout_width="320dp" android:layout_height="0.2dp" android:layout_gravity="center_horizontal" android:background="@color/text_gray" /> </FrameLayout> <View android:layout_width="match_parent" android:layout_height="280dp" android:background="@color/white" /> </LinearLayout> </ScrollView> </LinearLayout> </LinearLayout>下面会被遮挡,如果放在上面则会影响bottomsheet正常滑动,怎么解决
08-27
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
红包 添加红包
表情包 插入表情
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值