Android 为什么你们的九块图像隐藏了所有的内部元素?
当我将9.PNG图像设置为Android 为什么你们的九块图像隐藏了所有的内部元素?,android,android-relativelayout,nine-patch,Android,Android Relativelayout,Nine Patch,当我将9.PNG图像设置为RelativeLayout的背景时,它内部的所有元素都收缩到中间。这是XML和快照 <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="fill_parent" android:layout_height="fill_parent" android:backg
RelativeLayout
的背景时,它内部的所有元素都收缩到中间。这是XML和快照
<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:background="@drawable/bg"
>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Just a simple white text which does not show up"
android:textColor="#ffffff"
/>
</RelativeLayout>
有人能解释为什么会发生这种情况吗?您是否定义了九个补丁的内容区域?因为看起来内容区域是中间的小像素。
内容区域由九个补丁的底部和右侧定义。例如,您可以使其与您的补丁一样大。这里提供了您问题的明确答案:
android:background="@drawable/bg2" //normal image