我在drawable-mdpi中导入了一个图像,然后从按钮实现了图像,但是发生了错误no resource found here.我该如何解决这个问题?
我试过这个:
main.xml中
<Button
android:id="@+id/imageButtonSelector"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="@drawable-mdpi/button_focused_orange"/>
Run Code Online (Sandbox Code Playgroud)

我会在这个页面中创建一个这样的按钮(GetStarted按钮):http: //www.behance.net/signup/
我不知道如何创建蓝色背景渐变按钮.我不明白使用什么css属性.
谁能帮我?
非常感谢.
嗨我似乎有一些问题,Firefox在提交按钮中添加2个额外的填充像素.我已经在chrome和IE9中测试了这个并且两个浏览器都渲染了代码,Firefox似乎在底部添加了2个像素填充提交右上角有关键背景的按钮.这是网站:
这是该网站的代码:
<form method="post" action="index.html">
<input type="text" value="Username"/>
<input type="text" value="Password"/>
<input type="submit" id="submit" value=""/>
<img src="img/header/key.png" alt="" id="key"/>
</form>
header section form input{
color:#b3aaaa;
border:1px solid #cccccc;
float: left;
padding:5px 8px;
margin-left: 6px;
}
Run Code Online (Sandbox Code Playgroud)
我怎么能纠正这个?
如果没有这方面的解决方案可以请给我一个解决方案,输入文本与输入提交相同,输入文本是从上到下的中心?

编辑:我已经在另一台计算机上检查了这一点,似乎Firefox正确呈现这一点我之前遇到过这种类型的问题,相同的浏览器版本显示网站在不同的计算机上有点不同.最后一次类似的事情发生在chrome.I never可以解决这个问题.
任何人都知道为什么同一个浏览器会在具有相同屏幕尺寸和分辨率的不同计算机上呈现不同的页面?
我有一个带有数字行的数据网格.每行都有DeleteRow按钮.只有选中的行才能显示此按钮.我认为可能至少有两种解决方案:
a)将按钮的Visibility属性绑定到包含DatGridRow的IsSelected属性
要么
b)使用按钮中的触发器仅在选择包含行时才可见.
这是我对选项b的代码,它不起作用:
<DataGridTemplateColumn Width="50">
<DataGridTemplateColumn.CellTemplate>
<DataTemplate>
<Button Content="X" Tag="{Binding}" Click="DeletRow_Click" Visibility="Hidden">
<Button.Style>
<Style x:Name="ButtonVisibility">
<Style.Triggers>
<DataTrigger Binding="{Binding RelativeSource={RelativeSource Mode=FindAncestor,AncestorType={x:Type DataGridRow}},Path=IsSelected}" Value="True">
<Setter Property= "Button.Visibility" Value="Visible"/>
</DataTrigger>
</Style.Triggers>
</Style>
</Button.Style>
</Button>
</DataTemplate>
</DataGridTemplateColumn.CellTemplate>
Run Code Online (Sandbox Code Playgroud)
这可能很容易,但我一直盯着看,这让我眼花缭乱:S
谢谢
我有一个按钮,我用LinearGradientBrush设置按钮背景样式.一切正常,但当我运行按钮,然后按下按钮,然后渐变颜色显示ob按钮与动画的位,但我没有为按钮背景样式的动画写任何东西.
这是我的完整代码
<Window x:Class="WpfApplication1.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Title="MainWindow" Height="350" Width="525">
<DockPanel>
<Button Content="Button" Height="23" Name="button1" Width="75">
<Button.Background>
<LinearGradientBrush StartPoint="0,0" EndPoint="1,1">
<GradientStop Color="#FFD9EDFF" Offset="0"/>
<GradientStop Color="#FFC0DEFF" Offset="0.445"/>
<GradientStop Color="#FFAFD1F8" Offset="0.53"/>
</LinearGradientBrush>
</Button.Background>
</Button>
</DockPanel>
</Window>
Run Code Online (Sandbox Code Playgroud)
我希望当用户点击按钮然后渐变动画时,任何事情都不会在按钮上启动.请指导我.谢谢
我已经为大量页面创建了许多按钮(通常在表格单元格内每页底部连续5-10个)使用input type="button" name="..." value="..." onclick="some javascript event handler"等,基本上链接到同一组的其他页面.所有这些页面最终都是从单个页面上的iframe标记链接的.这些按钮在我的电脑上至少可以脱机工作.但是,现在我突然意识到我没有为这些按钮使用任何"形式"标签.
所以我的问题是,这个"形式"标签真的有必要吗?上传后会有任何问题吗?如果没有必要,我宁愿不将表单标签添加到这么多页面,因为这将是一个真正的拖累.但是,之后我也不想受苦.
无论如何检测是否加载了jquery-mobile /或任何其他库?
我知道我可以做一个简单的$('#button').button('enable');就像这里提到的如何启用jQuery Mobile按钮?但为了好玩,我只想知道是否有任何方法可以检测是否加载了库,然后执行上面的代码
我想在styles.xml中默认应用按钮文本颜色
<resources xmlns:android="http://schemas.android.com/apk/res/android">
<style name="AppTheme">
<item name="android:windowFullscreen">true</item>
<item name="android:windowBackground">@color/black</item>
<item name="android:textColor">@color/green</item>
</style>
Run Code Online (Sandbox Code Playgroud)
如何制作样式更改按钮颜色,并应用于整个应用程序?我的主要节日包括:
<application
android:icon="@drawable/ic_launcher"
android:label="Hack the World"
android:theme="@style/AppTheme">
Run Code Online (Sandbox Code Playgroud)
这会更改所有文本(例如TextView),但不会更改按钮中的文本.如果我使用上面的ColorThemes样式并将其放在按钮的xml中,如下所示:
<Button
android:id="@+id/button3"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:layout_centerVertical="true"
android:onClick="loadSavedgame"
android:text="Load Saved Game"
android:textColor="@color/green" />"
Run Code Online (Sandbox Code Playgroud)
然后它完美地运作.为什么这种风格不适用于普遍?styles.xml的所有不同版本都具有相同的代码.
我有一个包含drawable和text的按钮.我希望按钮的背景与提供的正常背景不同(最好是纯色).这很好用,我只是使用android:backgroundXML文件中的属性并相应地分配颜色.但是,我希望背景在选择或聚焦时变为不同的颜色(状态选择器).
我试图在一个带有定义颜色的drawable文件夹中创建一个选择器(在处理按钮文本时效果很好),如下所示:
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:state_focused="true" android:state_pressed="false" android:color="@color/green" />
<item android:state_focused="true" android:state_pressed="true" android:color="@color/green" />
<item android:state_focused="false" android:state_pressed="true" android:color="@color/green" />
<item android:color="@color/white" />
</selector>
Run Code Online (Sandbox Code Playgroud)
并将此xml设置为android:background属性,如下所示:
android:background="@drawable/button_state"
Run Code Online (Sandbox Code Playgroud)
但这导致一个力量关闭说明:
Caused by: android.content.res.Resources$NotFoundException: File res/drawable/button_state.xml from drawable resource ID #0x7f020070
Run Code Online (Sandbox Code Playgroud)
但资源就在那里.你能不自定义背景状态?如果可以,怎么样?或者我做错了什么?谢谢您的帮助!
我的按钮看起来像横向的顶部图像:
截图http://i46.tinypic.com/33zb9dj.jpg
我希望它看起来像底部图像.
这是我的这些按钮的.xml代码.
<TableRow
android:id="@+id/tableRow7"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:weightSum="1.0" >
<ImageButton
android:id="@+id/appHome"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight=".5"
android:background="@null"
android:contentDescription="Home"
android:cropToPadding="true"
android:scaleType="fitEnd"
android:src="@drawable/home_bar" />
<ImageButton
android:id="@+id/menuHome"
android:layout_weight="0"
android:background="@null"
android:contentDescription="Menu"
android:cropToPadding="true"
android:scaleType="center"
android:src="@drawable/menu_bar" />
<ImageButton
android:id="@+id/back"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight=".5"
android:background="@null"
android:contentDescription="Back"
android:cropToPadding="true"
android:scaleType="fitStart"
android:src="@drawable/back_bar" />
</TableRow>
Run Code Online (Sandbox Code Playgroud)