I have a simple XML:
sudo -u otheruser command
The problem is: neither in emulator or real device is showing LinearLayout and EditText when RelativeLayout has a background.
If I just remove the background everything works fine... it's weird.
Not error logs about app.
minSdkVersion 17
targetSdkVersion 22
UPDATED
Its working with normal background image (non 9patch). So the problem is about background 9patch image.
UPDATED 2 There is a lot of questions/answers about using 9patch in background in SO, but because the problem I faced was applying the background I started to looking in google for "background image problems". Of course none of the result in google throw me any useful answer. When Kai gave me and advice about the problem I easily found the problem. So I'm not going to close the question because it can help to someone to go through.
答案 0 :(得分:1)
问题是您的背景设置为9patch图像,该图像不定义拉伸区域(左角和上角)和可绘制区域(右角和下角)。
解决方案是修改9patch图像以包含必要的信息,或将填充设置为0(XML中为android:padding="0dip"
或代码中为setPadding(0)
。)