I created a file digital_clock_background.xml (inside res/drawable) and put 
this code:

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

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

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

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

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

</shape>

So my AppWidget layout is basically:

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android";
    android:id="@+id/rllWidgetBigger"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:layout_margin="@dimen/widget_margin"
    android:background="@drawable/digital_clock_background" >

    <ImageView
        android:id="@+id/imgBackGroundBigger"
        android:layout_width="fill_parent"
        android:layout_height="fill_parent"
        android:layout_alignParentBottom="true"
        android:layout_alignParentLeft="true"
        android:layout_alignParentRight="true"
        android:layout_alignParentTop="true"
        android:contentDescription="@string/app_name"
        android:scaleType="centerCrop"
        android:src="@drawable/digital_andromeda_galaxy_m31" />

</RelativeLayout>

And, well, the RelativeLayout now have rounded corners, but the ImageView 
doesn't. And it's corners are coming out of the RelativeLayout...

Is there anyway to correct it (without putting more padding)?

Thanks!

Em terça-feira, 4 de dezembro de 2012 00h19min37s UTC-2, Mário César 
Mancinelli de Araújo escreveu:
>
> Hi everyone.
>
> It's really not a code issue, but a layout one. So, if anyone could help 
> me, it would be nice.
>
> The thing is that I'm gonna have to use an image, an picture, as 
> background for an AppWidget. So, basically, I'm gonna use an ImageView to 
> show the image, setting the scale type to CENTER_CROP. Everything else 
> (TextViews and so on) go on top of that.
>
> The problem is that I will need to show a border in the AppWidget, with 
> rounded corners. So, what's the best way of doing that? The only way I can 
> think of is to use a black 9-patch as background of the RelativeLayout 
> (were the ImageView is going to be inside of) and set a small padding to 
> it... But I don't know if it's going to be good enough...
>
> So... Any ideas?
>
> Thanks in advance!
>
>

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to