如何借鉴的LinearLayout行? [英] How to draw a line on the LinearLayout?

查看:119
本文介绍了如何借鉴的LinearLayout行?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

你知道怎么画就行了的LinearLayout ?要创建一个的LinearLayout ,我使用的是XML资源:

Do you know how to draw line on the LinearLayout? To create a LinearLayout, I am using a xml resource:

@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main_layout);
    LinearLayout linear = (LinearLayout)findViewById(R.id.linearlayout);
    //I wanna draw line on "linear"
}

这可能吗?

推荐答案

有很多方法;一种方法是定义一个 ShapeDrawable 重新presenting XML中的线(在 RES 文件夹),集随着中说,后台资源的一个的ImageView 中的的LinearLayout

There are many ways; one way is to define a ShapeDrawable representing the line in XML (in your res folder) and set that as the background resource of say, an ImageView inside the LinearLayout.

您可以阅读更多有关的文档。

随意提供一些更多的内容(具体使用情况),所以我可以解释一下答案或其他人可以回答。

Feel free to provide some more context (specific use case) so I could elaborate on this answer or others could answer.

这篇关于如何借鉴的LinearLayout行?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆