开发者

1x1 size Nine-patch image not showing up on Android emulator device

I'd like to use a 1x1 size Nine-patch image from Android drawable resources.

When I'm trying to display it with <ImageView> in my layout xml file, this one is never showing up on the Android emulator device. Here's the xml code below:

开发者_C百科<?xml version="1.0" encoding="UTF-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:padding="10px"
>
<RelativeLayout 
 android:gravity="center_vertical"
 android:layout_width="fill_parent"
 android:layout_height="wrap_content">

 <TextView android:id="@+id/text_label"
     android:text="@string/text"
     android:textSize="10pt"
     android:layout_width="wrap_content"
     android:layout_height="wrap_content" />

 <CheckBox android:id="@+id/my_checkBox"
     android:layout_alignBaseline="@id/text_label"
     android:layout_alignParentRight="true"  
     android:layout_width="wrap_content"
     android:layout_height="wrap_content" />

</RelativeLayout>

<ImageView android:paddingTop="10px"
        android:paddingBottom="10px"
   android:layout_height="wrap_content"
  android:layout_width="fill_parent"
     android:src="@android:drawable/divider_horizontal_bright" />
</LinearLayout>

I tried another one with the same size and I have the same problem it's still blank.

My research on Google was irrelevant. Hope you can find what am I doing wrong here.

Thanks in advance for your help.

Lorenth


What version of the SDK are you writing for? Take a peek at the divider_horizontal_bright.png files in the different versions :) It's 99% transparent in 8, but like 50% transparent light grey in 4.

Or, Perhaps you meant divider_horizontal_bright_opaque?


This works for me:

<ImageView
  android:layout_width="fill_parent"
  android:layout_height="wrap_content"
  android:src="@android:drawable/divider_horizontal_dark"
  android:scaleType="fitXY"
/> 
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜