如何在android的底部工作表顶部添加一个ImageView

时间:2018-01-06 04:54:42

标签: android layout android-imageview bottom-sheet

enter image description here我有一个应用程序,我想在底部页面顶部创建一个带有ImageView的底部工作表。我如何实现这种类型的布局。请帮帮我

底页代码。

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:paddingBottom="8dp"
android:paddingTop="8dp">

<!-- NOTE: This list should be displayed in a list
instead of nested layouts -->

<LinearLayout
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:clickable="true"
    android:foreground="?attr/selectableItemBackground"
    android:orientation="horizontal"
    android:paddingBottom="8dp"
    android:paddingLeft="8dp"
    android:paddingRight="8dp"
    android:paddingTop="8dp">

    <ImageView
        android:layout_width="24dp"
        android:layout_height="24dp"
        android:layout_marginRight="32dp"
        android:src="@drawable/ic_menu_camera"
        android:tint="#737373" />

    <TextView
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_gravity="center_vertical"
        android:text="Preview"
        android:textColor="#737373"
        android:textSize="16sp" />

</LinearLayout>

1 个答案:

答案 0 :(得分:0)

使用

android:layout_gravity="center_Horizontal"

&安培;为图像提供填充 使用

android:padding="Size"

android:paddingLeft="Size"
android:paddingRight="Size" 
  

还可以尝试相对视图在设计视图中相应地设置