2

をカタチにしたいLinearLayout's backgroundimage。私は次のxmlを使用しています。しかし、曲線のみを表示しながら画像を表示していません。

<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android" >
    <corners android:radius="7dp" />
    <stroke android:width="1dp"/>
    <item>
      <bitmap android:src="@drawable/locationlable" />
    </item>
</shape>
4

3 に答える 3

1

これを試して

あなたのレイアウトで

    <FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:orientation="vertical" 
    android:background="#FFF">

    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:layout_margin="5dip"
        android:background="@drawable/background"
        android:orientation="vertical" />

    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:background="@xml/shape_round_rect"
        android:orientation="vertical" />

</FrameLayout>

& 形状の xml で

<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
    android:shape="rectangle" >

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

    <stroke
        android:width="5dip"
        android:color="#FFF" />

</shape>
于 2013-02-14T13:58:22.677 に答える
0

円形を描きたい場合は、別の形状を使用します。

android:shape="ring" 

長方形を描画する場合は、以下のコードを使用します。

<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle" >

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

<stroke
    android:width="2dp"
    android:color="#000000" />


 </shape>

詳細については、このリンクにアクセスしてくださいhttp://developer.android.com/guide/topics/resources/drawable-resource.html#Shape

于 2013-02-14T13:37:58.567 に答える