我有一个带有表单元素的主页面,defaultbutton属性设置为服务器端的ImageButton.在我的一个页面上,我想通过在Page_Load事件中设置Forms DefaultButton来"覆盖"masterpage defaultbutton属性.
即在主页上:
<form id="form1" runat="server" defaultbutton="btnSearch">....</from>
Run Code Online (Sandbox Code Playgroud)
在"覆盖"主页面属性的页面Page_Load事件上:
this.Form.DefaultButton = this.ibRecalc.ID;
Run Code Online (Sandbox Code Playgroud)
它错误:
'form1'的DefaultButton必须是IButtonControl类型的控件的ID
我正在使用实现IButtonControl的图像按钮
我可能做错了什么或以不同方式解决问题的任何想法?
谢谢
你能帮我吗?我试过了 :
ImageButton imgbt=(ImageButton)findViewById(R.id.imgbutton);
Uri imgUri=Uri.parse("/data/data/MYFOLDER/myimage.png");
imgbt.setImageUri(imgUri);
Run Code Online (Sandbox Code Playgroud)
但我没有看到任何东西,只是一个空白按钮.
我有一个如下定义的图像按钮.
<ImageButton
android:text="Play"
android:src="@drawable/playpause"
android:background="@drawable/opaque"
android:gravity="center_horizontal"
android:id="@+id/player_ctrl_btn"
android:layout_width="fill_parent"
android:padding="0px"
android:layout_height="wrap_content" />
Run Code Online (Sandbox Code Playgroud)
我想设置要选择的按钮的默认状态.所以在代码中我会说:
playBtn.setSelected(true);
是否可以在xml中执行此操作?
单击图像按钮时,如何让图像按钮保持"按下"状态?基本上我只想让背景成为沮丧的背景,但我无法弄清楚如何设置它.目前,我刚刚将所选按钮背景复制到我的res文件夹中,但当我将其设置为背景时,它变得模糊(因为原始图像比按钮本身大).
普通背景: 替代文字http://img707.imageshack.us/img707/9199/ss20100426163452.png 我得到的内容: 替代文字http://img707.imageshack.us/img707/912/ss20100426163357.png 替代文字http ://img3.imageshack.us/img3/8304/ss20100426163623.png
考虑到许多不同的UI布局,我也不相信我可以实际使用这种方法.按钮应按照用户使用的UI保持按下状态.
我正在为Android TV开发一个应用程序.我有一个listview
与ImageButton
+ Textview
S作为孩子.由于电视不接受触摸事件但使用D-PAD或轨迹球遥控器,我必须关注所有可点击的项目,以便用户知道焦点在哪里.但问题是,如果我添加,我可以专注于列表行
android:descendantFocusability="blocksDescendants"
在自定义列表行布局中但ImageButton
在列表行中将无法获得焦点.如果我删除上面的代码然后ImageButton
获得焦点但我不能单击列表行.
此外,我增加setItemsCanFocus
了我ListView
,但没有运气,没有什么改变.我读了很多文件,但我找不到这个问题的正确答案.我希望专注于List行以及ImageButton
.是否有可能,如果有人知道请帮帮我...
我需要为我的应用程序创建一个图像按钮,如面向Web的样式.我有一个20x20像素的图像,并希望图像按钮具有相同的图像尺寸.
我试图在我的xaml中设置它但它不起作用:
<Button Grid.Row="0" Margin="0" Padding="0" Click="AddtoFavorite_Click" Width="20" Height="20" VerticalAlignment="Top" HorizontalAlignment="Right">
<Button.Content>
<Image Source="/MyNamespace;component/images/star_yellow.png" Margin="0" Width="20" Height="20" />
</Button.Content>
</Button>
Run Code Online (Sandbox Code Playgroud)
怎么了?
我发现最好的解决方案是:
<Image Source="/MyNamespace;component/images/star_yellow.png" ManipulationStarted="Image_ManipulationStarted" Width="20" Height="20"></Image>
Run Code Online (Sandbox Code Playgroud)
谢谢大家!
我正在使用ImageButton
.但是点击后我没有得到突出显示.我用Google搜索并且许多建议使用选择器显示另一个图像.有没有办法解决.只使用一个图像并突出显示它或给它一个发光效果.以便用户知道该按钮已被点击.
我正在尝试构建一个带有图像按钮的应用程序,它像操作栏一样工作,但我无法让它们在长按时显示工具提示.
<ImageButton
android:id="@+id/editUrgent"
style="?android:attr/borderlessButtonStyle"
android:layout_width="48dp"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:layout_toLeftOf="@+id/editImportant"
android:hint="@string/hint_urgent"
android:contentDescription="@string/hint_urgent"
android:text="@string/hint_urgent"
android:src="@drawable/clock_light" />
Run Code Online (Sandbox Code Playgroud)
android:contentDescription适用于悬停(s-pen)但长按仍然无效.
我有一个带有在AlertDialog中膨胀的ImageButton的布局,我应该在哪里/如何设置onClick监听器?
这是我尝试使用的代码:
ImageButton ib = (ImageButton) findViewById(R.id.searchbutton);
ib.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Toast.makeText(TravelBite.this, "test", Toast.LENGTH_SHORT).show();
}
});
Run Code Online (Sandbox Code Playgroud) [辅助功能]图像上缺少contentDescription属性
这个错误意味着什么,我该如何解决?
<ImageButton
android:id="@+id/callbannerbuttonpg1"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_marginTop="157dp"
android:background="@null"
android:src="@drawable/callbanner"
android:visibility="invisible" />
Run Code Online (Sandbox Code Playgroud)