gpt4 book ai didi

android - ImageView 在卡片 View 的顶部

转载 作者:塔克拉玛干 更新时间:2023-11-03 00:45:16 25 4
gpt4 key购买 nike

我有一个圆形的 imageview,我需要在 cardview 上方对齐,但它应该像图像的半圆将在 cardview 之外图像的剩余半圈位于 cardview 内。就像 cardview 的顶部边框中心将有圆形的 imageview 出现在它上面。

我该怎么做,我将无法上传图片,因为我的代理不允许,对于不便,我深表歉意。

enter image description here

最佳答案

这可以像这样完成。

<?xml version="1.0" encoding="utf-8"?>
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:card_view="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="@+id/activity_main"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:paddingBottom="@dimen/activity_vertical_margin"
android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin"
android:paddingTop="@dimen/activity_vertical_margin"
tools:context="com.simplebox.demo.MainActivity">

<android.support.v7.widget.CardView
android:id="@+id/first"
app:cardBackgroundColor="@android:color/white"
app:cardCornerRadius="@dimen/cardview_default_radius"
app:cardElevation="4dp"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="50dp"
card_view:cardUseCompatPadding="true">

<RelativeLayout
android:layout_width="match_parent"
android:layout_height="300dp"
android:background="#FFF000">
</RelativeLayout>
</android.support.v7.widget.CardView>

<ImageView
android:layout_width="100dp"
android:layout_height="100dp"
android:layout_gravity="center_horizontal"
android:background="#000000"
android:contentDescription="@null" />

</FrameLayout>

输出将是。圆形图像使用圆形 ImageView 。

enter image description here

关于android - ImageView 在卡片 View 的顶部,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39869586/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com