【问题标题】:how to make image at top of bottom sheet in android如何在android的底部工作表顶部制作图像
【发布时间】:2021-01-26 05:26:34
【问题描述】:

如何将图像放置在底部表格的顶部中心,并且图像的一半应该在布局之外,,,我附上了示例图像

`<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout 
 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="wrap_content"
 android:paddingStart="@dimen/dimen_25"
 android:paddingEnd="@dimen/dimen_25"
 android:paddingBottom="@dimen/dimen_25">

 <androidx.appcompat.widget.AppCompatImageView
     android:id="@+id/iv_success_image"
     android:layout_width="wrap_content"
     android:layout_height="wrap_content"
     app:layout_constraintEnd_toEndOf="parent"
     app:layout_constraintStart_toStartOf="parent"
     app:layout_constraintTop_toTopOf="parent"
     app:srcCompat="@drawable/ic_tick" />`

【问题讨论】:

    标签: android layout android-constraintlayout


    【解决方案1】:
       <?xml version="1.0" encoding="utf-8"?>
    <RelativeLayout 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:orientation="vertical">
    
        <LinearLayout
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:orientation="vertical">
    
            <LinearLayout
                android:id="@+id/nilu"
                android:layout_width="match_parent"
                android:layout_height="match_parent"
                android:layout_weight="1"
                android:background="@color/colorPrimary"
                android:orientation="vertical"
                android:paddingBottom="30dp">
    
    
                <TextView
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:gravity="center"
                    android:text="NILU" />
    
                <TextView
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:gravity="center"
                    android:text="NILU" />
    
                <TextView
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:gravity="center"
                    android:text="NILU" />
    
    
            </LinearLayout>
    
            <LinearLayout
                android:id="@+id/nilu2"
                android:layout_width="match_parent"
                android:layout_height="match_parent"
                android:layout_below="@id/nilu"
                android:layout_weight="1"
                android:background="@color/colorAccent"
                android:orientation="vertical">
    
    
                <TextView
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:gravity="center"
                    android:text="NILU" />
    
                <TextView
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:gravity="center"
                    android:text="NILU" />
    
                <TextView
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:gravity="center"
                    android:text="NILU" />
    
            </LinearLayout>
        </LinearLayout>
    
    
        <RelativeLayout
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:layout_centerInParent="true"
            android:orientation="horizontal">
    
            <ImageView
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_centerInParent="true"
                android:src="@mipmap/ic_launcher_round" />
    
    
        </RelativeLayout>
    
    </RelativeLayout>
    

    【讨论】:

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