我有以下的XML对象代表的ImageButtonLayoutInflater忽略参数?
<?xml version="1.0" encoding="utf-8"?>
<ImageButton
xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/genreCellItemId" android:layout_weight="1"
android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_gravity="center"
android:paddingLeft="5.0dip" android:paddingRight="5.0dip">
</ImageButton>
我试图夸大它,它用下面的代码添加到的TableRow:
LayoutInflater inflater= this.getLayoutInflater();
TableLayout grid = (TableLayout)findViewById(R.id.bodyTableLayout);
TableRow row = (TableRow)inflater.inflate(R.layout.genre_row, null);
View myButton = (View)inflater.inflate(R.layout.genre_cell, null);
row.addView(tempButton, new TableRow.LayoutParams());
grid.addView(row, new TableLayout.LayoutParams());
好了,所以我注意到,它并没有看起来如预期的那样,所以我启动了Hierarchy Viewere,并注意到ImageButton实际上有一个layout_width = FILL_PARENT而不是WRAP_CONTENT,layout_gravity也是NONE,并且没有可见的填充...
Do,am I错误地夸大它?或者也许是新的TableRow.LayoutParams()部分做错了什么?
嗨,我膨胀我的观点从XML并显示在弹出窗口中,但它缺少它的父亲填充 – 2013-12-19 08:12:12