簡體   English   中英

如何在Android底部工作表的頂部添加ImageView

[英]How to add an ImageView at the top of bottom sheet in android

在這里輸入圖像描述,我有一個應用程序,我要在其中創建一個底部圖像,並在底部圖像頂部放置一個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_gravity="center_Horizontal"

並使用提供填充圖像

android:padding="Size"

要么

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

也可以嘗試相對視圖以在設計視圖中進行相應設置

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM