【问题标题】:How to add an ImageView at the top of bottom sheet in android如何在android的底部工作表顶部添加一个ImageView
【发布时间】:2018-01-06 18:17:31
【问题描述】:

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>

【问题讨论】:

  • 你解决了吗..?
  • 否....
  • 看到我已经按照我想要的方式编辑了图像
  • 你试过我下面的回答了吗
  • 是的,我试过了,但主布局仍然可见

标签: android layout android-imageview bottom-sheet


【解决方案1】:

使用

android:layout_gravity="center_Horizontal"

& 为图像提供填充 使用

android:padding="Size"

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

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

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2020-10-10
    • 2021-05-27
    • 2019-10-19
    相关资源
    最近更新 更多