我有这个字段
$mobile = new Zend_Form_Element_Textarea('mobile');
$mobile->setLabel('mobile')
->addFilter('StripTags')
->addFilter('StringTrim')
->setOptions(array('class' => 'full-width'))
->setAttrib('rows', 2)
->getDecorator(('label'))->setOption('tag', 'span');
$this->addElement($phone);
但我需要只读,但我会在数据表中添加内容
答案 0 :(得分:1)
您可以使用setAttrib
方法设置任何属性。
->setAttrib('readonly', 'true');
答案 1 :(得分:0)
readonly
将设置字段的属性。也可以通过->setOptions(array('class' => 'full-width', 'readonly' => true))
。试试 -
public class AdMobBanner extends FrameLayout {
private AdView adView;
public AdMobBanner(Context context, AdParams params) {
super(context);
adView = new AdView(context);
FrameLayout.LayoutParams layoutParams = new FrameLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT);
layoutParams.gravity = Gravity.CENTER;
adView.setLayoutParams(layoutParams);
adView.setAdSize(AdSize.BANNER);
adView.setAdUnitId(params.getAdUnitId());
addView(adView);
}
public void showAdvert(AdParams params) {
AdRequest.Builder builder = new AdRequest.Builder();
for (String id: params.getTestDevices()) {
builder.addTestDevice(id);
}
adView.loadAd(builder.build());
}
@Override
public void pause() {
adView.pause();
}
@Override
public void resume() {
adView.resume();
}
}