I want to use a nine-patch image to make a splash screen for my application, which should look the same (square) in both portrait and landscape orientation.
My code is simple:
public void onCreate(Bundle icicle) {
super.onCreate(icicle);
setContentView(R.layout.splashscreen);
// more code here...
}
My resource file is:
<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android" >
<item>
<bitmap android:src="@drawable/launch_image" />
</item>
</layer-list>
Nine-patch image looks fine in Draw 9-patch utility:
But as the result the image is stretched:
What's wrong? Can nine-patch images be used this way at all?
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…