如何为LinearLayout创建背景,如下图所示。我不知道该怎么做。如何为LinearLayout创建背景,如下图所示
-9
A
回答
0
可以使用相对布局上方添加另一个查看查看。对于上面提到的图像,你只需要两张图片而且你要这样创建布局:
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent" >
<ImageView
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:background="@drawable/white_image" />
<ImageView
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:background="@drawable/yellow_image" />
</RelativeLayout>
添加动态视图,您可以覆盖位图:
LayoutInflater inflater = LayoutInflater.from(getActivity());
Bitmap bitmapCopy1 = Bitmap.createBitmap(image.getWidth(), image.getHeight(), Bitmap.Config.ARGB_8888);
canvas1 = new Canvas(bitmapCopy1);
Bitmap pinImage = Utility.createBitmap(pinFloor);
canvas1.drawBitmap(pinImage, leftPos[i], topPos[i], new Paint());
firstImage.setImageBitmap(firstBitmap);
firstImage.setImageBitmap(bitmapCopy1);
firstImage.invalidate();
+0
但根据我的要求,我必须以编程方式绘制它,而不使用图像...... –
+0
@ user3074539扩展'View'并覆盖方法'onDraw()'。你可以绘制任何你喜欢的东西(编程)。 – skywall
0
与背景创建RelativeLayout
的黄色,并在顶部添加圆形图像。
这是一个更为动态的解决方案要比使用单一形象为RelativeLayout
将根据屏幕大小/方向改变大小,而不是影响圈
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:background="#ffc20e">
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentTop="true"
android:layout_centerHorizontal="true"
android:background="@drawable/circle_image" />
</RelativeLayout>
相关问题
- 1. 如何为LinearLayout创建渐变背景?
- 2. 如何以编程方式为LinearLayout创建背景
- 3. Linearlayout背景图像
- 4. 将进度条下载为LinearLayout背景
- 5. 如何为所有屏幕尺寸创建图像作为背景图像
- 6. Droid x,Linearlayout背景图片未显示?
- 7. 如何创建tkinter背景图片?
- 8. 如何用背景图像创建PIXI.text
- 9. Android:如何从图案创建背景?
- 10. 使用Theme.Light背景作为LinearLayout背景
- 11. 由于动画只能设置为背景,所以如何创建背景?
- 12. 带背景的LinearLayout不显示小孩的所有视图
- 13. Linearlayout中的背景图像
- 14. Android - LinearLayout背景“over”视图
- 15. ActionBarSherlock:创建视图如下所示
- 16. 如何显示的图像为背景
- 17. 的LinearLayout背景
- 18. 如何使LinearLayout透明背景?
- 19. 如何在onCreate期间更改ListView项目背景LinearLayout背景?
- 20. 如何为静态背景图像创建悬停效果...?
- 21. 如何为中心的社交图标创建灰色背景?
- 22. 如何为网站创建背景图片
- 23. 如何为Launcher应用程序图标创建透明背景
- 24. 如何在HTML5和CSS3中创建以下图片作为标题背景?
- 25. 为视图创建纹理背景
- 26. 为View创建图案背景
- 27. 如何在OpenGL(GLUT)场景中创建静态背景图像?
- 28. 如何创建如下图所示的列表?
- 29. 如何在R中创建如下所示的图形?
- 30. 如何创建如下图所示的客户标签?
最简单的方法是把一个图片的大小如背景。 –
指定你给出-ive投票的理由.... –
我想以某种方式绘制它,不想使用图片.... @MikiFranko –