0

画面の中央にドローアブルがある別のアクティビティの上に、半透明の背景を持つアクティビティを表示しようとしています。ドローアブルは角が丸くなっており、レイアウトの背景として角が丸くなった長方形を設定しました。シェイプには、背景としてドローアブルがあります。問題は、角の丸いドローアブルの背後に黒い四角い境界線が表示されることです。その黒い境界線を取り除く方法はありますか?

評判が悪いから写真載せないのかな?

レイアウトの xml は次のとおりです。

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:id="@+id/custom_toast_layout_id"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"    
    android:orientation="horizontal"
    android:padding="5dp"   
    android:gravity="center"
    android:background="@drawable/myshape" >


    <TextView
        android:id="@+id/text1"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="hello"
        android:textColor="#000000"
        android:textSize="30sp" />


</RelativeLayout>

形状の xml は次のとおりです。

<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android" >
    <item android:drawable="@drawable/blank_colordots_test">
        <shape android:shape="rectangle" android:padding="10dp">             
            <corners
                android:bottomRightRadius="35dp"
                android:bottomLeftRadius="35dp"
                android:topLeftRadius="35dp"
                android:topRightRadius="35dp"/>
        </shape>
    </item>
</layer-list>
4

3 に答える 3

2

このコードを試してください:

rounded_drawable.xml

<shape xmlns:android="http://schemas.android.com/apk/res/android" >

    <corners android:radius="15dp" />

    <solid android:color="#565656" />

    <stroke
        android:width="3dp"
        android:color="#ffffff" />

    <padding
        android:bottom="6dp"
        android:left="6dp"
        android:right="6dp"
        android:top="3dp" />

</shape>

このスタイルを宣言します:

  <style name="ThemeWithCorners" parent="android:Theme.Dialog">

          <item name="android:windowNoTitle">true</item>
    </style>

このスタイルをマニフェストに適用します。

于 2014-09-15T16:52:04.093 に答える
0

これはあなたの要件に合うはずです:

//レイアウト:

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:layout_margin="10dp"
    android:background="@drawable/myshape"
    android:gravity="center">


    <TextView
        android:id="@+id/text1"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="hello"
        android:textColor="#000000"
        android:textSize="30sp" />

</RelativeLayout>

//形:

<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
    <item
        android:bottom="0dp"
        android:left="0dp"
        android:right="0dp"
        android:top="0dp">
        <shape android:shape="rectangle">
            <solid android:color="#000000" />
            <corners android:radius="4dp" />
            <stroke
                android:width="1dp"
                android:color="#000000" />
        </shape>
    </item>
</layer-list>
于 2014-09-15T16:58:48.193 に答える