Tag: textview

Android TextView defStyle参数被忽略了吗?

请注意,我正在使用Mono for Android 我有一个ListView项目,可以通过单击列表底部的“更多”按钮进行扩展。 该列表以XML格式定义,但更多按钮只是一个可点击的TextView,它通过AddFooterView添加到列表的底部。 我试图将预定义的样式应用于运行时创建的TextView但它无法正常工作。 mMoreProductsButton = new TextView(this, null, Resource.Style.more_button); mMoreProductsButton.Text = “More”; mMoreProductsButton.Click += new EventHandler(MoreProductsButton_Click); mListView.AddFooterView(mMoreProductsButton); TextView文档显示了这个签名: TextView(Context context, AttributeSet attrs, int defStyle) defStyle在文档中定义为要应用于视图的默认样式。 我在其他地方看到的一个例子将null作为AttributeSet传递,但我不确定它是否有效或与我的问题有关。 我发现了这个错误,并且不确定它是否相关且最新: http : //code.google.com/p/android/issues/detail?id = 12683 任何建议表示赞赏!