我的问题似乎很容易,但我真的无法解决它。在某个时候,我的代码在AlertDialog
内的LinearLayout
中显示了一堆图像(ImageView
)。 问题是,并非所有内容都显示出来。LinearLayout将不会显示所有内容
这里是我的代码:
public LinearLayout createLayout(String text) {
LinearLayout ll = new LinearLayout(this.c);
int res;
for(int i=0; i<text.length(); ++i) {
res = this.c.getResources().getIdentifier("pigpen_" + Character.toLowerCase(text.charAt(i)), "drawable", this.c.getPackageName());
ImageView iv = new ImageView(this.c);
iv.setPadding(5, 0, 0, 5);
iv.setImageResource(res);
ll.addView(iv);
}
return ll;
}
而对于DialogAlert代码:
protected ResultDialog(final Context context, CharSequence title, LinearLayout ll) {
super(context);
ll.setPadding(10, 5, 10, 5);
this.setView(ll);
this.setTitle(title);
}
正如你所看到的,结果并不好。你有什么想法,为什么?
嗨。感谢您的帮助。我试过你的解决方案,但没有任何改变。我也试图把最低限度:布局是一个很好的高度,但图像仍然不是全部显示。完美的行为将是每种图像都有一些回车。你认为使用RelativeLayout会更好吗? – Passeur 2012-02-05 18:13:34
你可能会搜索'GridView'。 – poitroae 2012-02-05 19:11:52
我已经使用了一个TableLayout,每10张图片就有一个新的tableRow。我只关心它在大屏幕上的表现方式。 – Passeur 2012-02-07 09:39:06