我有一个看起来像这样的
ImageButton.
<ImageButton
android:id="@+id/ImageButton"
android:layout_width="200dp"
android:layout_height="200dp"
android:layout_gravity="center"
android:layout_marginBottom="6px"
android:layout_marginRight="3px"
android:layout_toRightOf="@+id/logo"
android:background="@drawable/button_bg_purple"
android:scaleType="fitStart"
android:src="@drawable/ImageButton" />
ImageButton ImgButton= (ImageButton) this.findViewById(R.id.ImageButton);
现在我需要以编程方式在ImageButton中添加动态文本,我不能使用按钮.
我该怎么做?
提前致谢 …
解决方法
ImageButton不能包含文本:
您可以尝试的选项
1)使用Button而不是ImageButton
2)使用下面的ImageButton和TextView来显示文本
希望这可以帮助