parent at the same time?
Is it possible to achieve something like this: I have one picture to set as a background on layout in which is also TextView. So I want that layout to set his height to wrap content (which should be the height of TextView) and ImageView to has fill_parent as height and width.
I tried using:
Is there a way to do this?
Sorry, if it's next question about the same, but I have no idea how to find a solution.
EDIT:
I'll try to be more specific. I want a TextView with background. But I want that background to be scaled to fit TextView which should be wrap_content width and wrap_content height. But I have image in higher resolution so there is a lot of unused space (background doesn't scale).
No, there is no way to set a view's width/height to both wrap_content
and fill_parent
simultaneously.
What exactly are you trying to achieve? Is this what you mean?
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="fill_parent"
...
android:background="@drawable/image" >
<TextView
android:layout_width="wrap_content"
android:layout_width="wrap_content"
... >
</TextView>
</LinearLayout>
EDIT
If you want to nicely scale a background image for a TextView
, I think what you might want to look into is a 9-patch image. See this post for more info. Also this.
上一篇: 使用RelativeLayout构建像ui一样的网格问题
下一篇: 家长在同一时间?