开发者

Background image with fading edges

I tried to put background image to linearlayout in my android project. All is working nicely except those fading edges in the left and right on the screen. My background image dimensions are 52x602 and don't have such fading edge originally. I want the background image to cover all the area. Also it has done by designer and using 9-patch I think (black border around image). How can I set the background correctly without those edges?

In emulator it looks like this:

Background image with fading edges

XML:

<?xml version开发者_C百科="1.0" encoding="utf-8"?>
<LinearLayout
  xmlns:android="http://schemas.android.com/apk/res/android"
  android:layout_width="fill_parent"
  android:layout_height="fill_parent"
  android:background="@drawable/login_background"
  android:orientation="vertical"
  >
</LinearLayout>


Ok, got answer myself. The .png files must have .9.png ending if they are 9-patch files...So if someone will have same problem, then you'll know.


Try setting fadingEdge to none

<LinearLayout
  xmlns:android="http://schemas.android.com/apk/res/android"
  android:layout_width="fill_parent"
  android:layout_height="fill_parent"
  android:background="@drawable/login_background"
  android:orientation="vertical"
  android:fadingEdge="none"
  >
</LinearLayout>
0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜