我创建一个tableLayout [XML中给出]
添加表行[在XML中创建和充气用Java]
也增加了2 TextView的表行[XML格式创建,并在充气JAVA]
我能够得到的只有背景和textcolors但不喜欢宽度,高度和利润率来获得表视图的布局属性。
解决方案首先声明的充气。
LayoutInflater吹气=(LayoutInflater)getApplicationContext()。getSystemService
(Context.LAYOUT_INFLATER_SERVICE);
确定并抬高你寻求项目当前视图的新视图。
查看视图= inflater.inflate(R.layout.new_layout,NULL);
您会希望您的新充气视图添加到您的布局。
main.addView(视图);
您可以参考这里附加信息:http://developer.android.com/reference/android/view/LayoutInflater.html
I'm creating a tableLayout [given in XML]
adding table Row [created in XML and inflating in Java]
also adding 2 textview to the table Row [created in XML and inflating in JAVA]
I'm able to get only the background and textcolors but not the layout properties like width, height and margin to get table view.
解决方案First declare your inflater.
LayoutInflater inflater = (LayoutInflater)getApplicationContext().getSystemService
(Context.LAYOUT_INFLATER_SERVICE);
Identify and inflate the new view you seek to project on the current view.
View view = inflater.inflate(R.layout.new_layout,null);
You would want to add your new inflated view to your layout.
main.addView(view);
You can reference additional information here: http://developer.android.com/reference/android/view/LayoutInflater.html