【问题标题】:remove small part from the circle从圆圈中删除小部分
【发布时间】:2017-08-08 03:18:25
【问题描述】:

朋友们,请帮忙,我尝试在以下形状下做超过三天,但无法得到它我该怎么做

但我得到的输出是这个

下面是我的代码

close_drawable.xml

    <layer-list xmlns:android="http://schemas.android.com/apk/res/android">
    <item>
        <shape android:shape="oval">
            <solid android:color="#30000000"/>
            <size android:height="70dp" android:width="70dp"/>
        </shape>
        <clip android:gravity="left" android:clipOrientation="horizontal"/>
    </item>
    <item android:drawable="@drawable/close" android:width="50dp" android:height="50dp" android:gravity="center"/>

</layer-list>

我的 Xml 代码是

    <RelativeLayout
        android:id="@+id/bottomroot"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_alignParentBottom="true"
        android:layout_marginBottom="5dp"
        android:gravity="center"
        android:orientation="horizontal">

        <ImageView
            android:id="@+id/nope"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            app:srcCompat="@drawable/close_drawable" />


        <ImageView
            android:id="@+id/superlike"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
android:layout_marginLeft="-1.5dp"
            android:layout_toRightOf="@+id/nope"
            app:srcCompat="@drawable/superlike_drawable" />

        <ImageView
            android:id="@+id/like"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_marginLeft="-1.5dp"
            android:layout_toRightOf="@+id/superlike"
            app:srcCompat="@drawable/like_drawable" />

        <ImageView
            android:id="@+id/like_list"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_marginLeft="-1.5dp"
            android:layout_toRightOf="@+id/like"
            app:srcCompat="@drawable/likelist_drawable" />

        <TextView
            android:id="@+id/textView2"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_alignStart="@+id/superlike"
            android:layout_alignEnd="@+id/superlike"
            android:gravity="center"
            android:layout_below="@+id/superlike"
            android:text="Mashalla!"
            android:textColor="#fff" />
    </RelativeLayout>

【问题讨论】:

  • 我认为你编辑错误的图片 - ok 和 not ok 看起来一样

标签: android xml android-layout android-shape android-shapedrawable


【解决方案1】:

你的圈子 xml 应该是这样的:

<shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="oval" >
<solid android:color="#20000000" />
<size
    android:width="70dp"
    android:height="70dp" />
</shape>

编辑:如果您在包含 ImageVIew 的布局中有填充,则可能会发生这种情况

【讨论】:

  • 对不起,我在上传问题时忘记使用代码格式
  • @prominere 你能添加你的整个布局吗?
  • 我已经用我尝试过的最新代码更新了我的代码,请检查
  • 尝试文件-> 使缓存无效并重新启动-?无效并重新启动。在这个干净的构建和重建项目之后。我已经复制了你的 xml,它看起来像图片
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 2020-03-01
  • 1970-01-01
  • 2018-03-05
  • 1970-01-01
  • 2020-02-14
  • 1970-01-01
  • 2022-10-13
相关资源
最近更新 更多