在xml中使用Android Shapes我已经定义了一个渐变,我将其用作按钮的背景.
这一切都很好,但按钮周围没有边缘.我希望它看起来类似于普通的Android按钮,但我需要更多的灵活性来控制颜色和外观.
形状定义如下:
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<gradient android:startColor="#FFFFFF"
android:endColor="#00FF00"
android:angle="270" />
<corners android:radius="3dp" />
<stroke android:width="5px" color="#000000" />
</shape>
Run Code Online (Sandbox Code Playgroud)
我希望边框可以在xml中设置.为什么不"中风"修复它?中风似乎没有做任何事情.我检查了Android Developer规范,但在那里找不到答案:http: //developer.android.com/guide/topics/resources/drawable-resource.html
我还查看了Android按钮的所有属性,但正如预期的那样,没有这样的参数,可能因为它内置于普通的Android按钮中.顺便说一句,我也检查过ImageButton属性.
有人可以帮忙吗?我知道可以使用适当的边缘制作图像并使用ImageButton,但实际上应该有一种方法可以通过编程方式修复此问题.
谢谢!安娜
让我来描述我的问题 -
我有一个Java应用程序 - Hibernate作为MySQL上的数据库接口层.我的应用程序中出现通信链接失败错误.发生此错误是一个非常具体的情况.我得到这个错误,当我让mysql服务器无人值守超过大约6个小时(即没有向MySQL发出超过大约6小时的查询).我正在粘贴下面的顶级"异常"级别描述,并为详细的堆栈跟踪描述添加了一个pastebin链接.
javax.persistence.PersistenceException:org.hibernate.exception.JDBCConnectionException - :org.hibernate.exception.JDBCConnectionException:无法打开连接致无法打开连接 - 致:com.mysql.jdbc.exceptions.jdbc4.CommunicationsException:通信链路failure - 从服务器成功收到的最后一个数据包是1,274,868,181,212毫秒之前.成功发送到服务器的最后一个数据包是0毫秒前. - 产生的原因:com.mysql.jdbc.exceptions.jdbc4.CommunicationsException:通信链路故障 - 从服务器成功接收最后一个包是1,274,868,181,212毫秒以前.成功发送到服务器的最后一个数据包是0毫秒前. - 引起:java.net.ConnectException:连接被拒绝:连接
链接到pastebin进行进一步调查 - http://pastebin.com/4KujAmgD
我从这些异常声明中理解的是,MySQL在一段空闲/零活动后拒绝接受任何连接.我一直在通过谷歌搜索阅读一下这个,并且知道克服这一点的一种可能方法是设置c3p0属性的值,因为c3p0与Hibernate捆绑在一起.具体来说,我从这里读到http://www.mchange.com/projects/c3p0/index.html,设置两个属性idleConnectionTestPeriod和preferredTestQuery将为我解决这个问题.但这些价值似乎没有产生影响.
这是解决这个问题的正确方法吗?如果没有,什么是克服这个的正确方法?
以下是stackoverflow.com上的相关Communications Link Failure问题,但我在答案中找不到满意的答案. com.mysql.jdbc.exceptions.jdbc4.CommunicationsException:通信链路故障 如何处理:通信链路故障
注1 - 当我连续使用我的应用程序时,我不会收到此错误.注2 - 我使用JPA和Hibernate,因此我的hibernate.dialect等hibernate属性驻留在META-INF文件夹的persistence.xml中(这是否会阻止c3p0属性工作?)
编辑 - 我试过的c3p0参数在评论中
如何在jsp中从jsp获取按钮值到servlet:
<input type=button name=bt value=gi onclick="document.frm.submit();"></input>
Run Code Online (Sandbox Code Playgroud)
在servlet中:
String gi =request.getParameter("bt");
System.out.print("button value" +gi);
Run Code Online (Sandbox Code Playgroud)
导致= NULL
谢谢
我想从 Maven 中创建的项目生成一个 .jar 应用程序。
我在 Eclipse 中工作,我做了: run as/Maven assembly: assembly
这是错误消息:
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-assembly-plugin:2.2-beta-4:assembly (default-cli) on project FeelIndexer: Error reading assemblies: No assembly descriptors found.
Run Code Online (Sandbox Code Playgroud)
这是我的assamble.xml
<assembly>
<id>exe</id>
<formats>
<format>jar</format>
</formats>
<includeBaseDirectory>false</includeBaseDirectory>
<dependencySets>
<dependencySet>
<outputDirectory></outputDirectory>
<outputFileNameMapping></outputFileNameMapping>
<unpack>true</unpack>
<scope>runtime</scope>
<includes>
<include>commons-lang:commons-lang</include>
<include>commons-cli:commons-cli</include>
</includes>
</dependencySet>
</dependencySets>
<fileSets>
<fileSet>
<directory>target/classes</directory>
<outputDirectory></outputDirectory>
</fileSet>
</fileSets>
</assembly>
Run Code Online (Sandbox Code Playgroud)
我想我必须包含其他内容来添加 muy 项目的依赖项,但我不知道该怎么做!建议??
更新:在我的 assembly.xml 下方
<assembly>
<id>exe</id>
<formats>
<format>jar</format>
</formats>
<includeBaseDirectory>false</includeBaseDirectory>
<dependencySets>
<dependencySet>
<outputDirectory></outputDirectory>
<outputFileNameMapping></outputFileNameMapping>
<unpack>true</unpack>
<scope>runtime</scope>
<includes>
<include>commons-lang:commons-lang</include>
<include>commons-cli:commons-cli</include>
</includes> …Run Code Online (Sandbox Code Playgroud) 有没有办法可以为Android中的EditText控件指定输入掩码?
我希望能够为社会安全号码指定类似### - ## - ####的内容.这将导致任何无效输入被自动拒绝(例如,我键入字母字符而不是数字数字).
我意识到我可以添加一个OnKeyListener并手动检查有效性.但这很乏味,我将不得不处理各种边缘情况.
嗡嗡
我正在使用PostgreSQL数据库,并在表示一些测量的表中我有两列:测量和插值.在第一个我观察(测量),在第二个内插值取决于附近的值.具有原始值的每个记录也具有内插值.但是,有许多记录没有"原始"观察(NULL),因此值被内插并存储在第二列中.所以基本上数据库中只有两种情况:
Value Value
NULL Value
Run Code Online (Sandbox Code Playgroud)
当然,最好使用第一列中的值(如果可用),因此我需要构建一个查询来从第一列中选择数据,如果不可用(NULL),则数据库返回第二列中的值有关记录的列.我不知道如何构建SQL查询.
请帮忙.谢谢.
我有许多版本相关的相关数据库.不同版本的实例可以并排运行,由不同版本标识,即[NorhwindV1.1]和[NorhwindV1.2]可以与[SouthwindV1.1]和[SouthwindV1.2]一起位于同一服务器上.
有许多存储过程可以进行跨数据库查询,即存在于NorthwindV1.1上,也存在于SouthwindV1.1中的查询表中.使用更改版本号管理数据库名称更改的最佳方法是什么,以便存储过程查询正确的数据库版本?
谢谢,MagicAndi.
我需要从文件夹中获取第一个文件名.我怎样才能在C#中获得这个?
下面的代码返回所有文件名:
DirectoryInfo di = new DirectoryInfo(imgfolderPath);
foreach (FileInfo fi in di.GetFiles())
{
if (fi.Name != "." && fi.Name != ".." && fi.Name != "Thumbs.db")
{
string fileName = fi.Name;
string fullFileName = fileName.Substring(0, fileName.Length - 4);
MessageBox.Show(fullFileName);
}
}
Run Code Online (Sandbox Code Playgroud)
我需要第一个文件名.
这就是我想要做的事情,我不能:
#include <string>
using namespace std;
class A {
public:
bool has() const { return get().length(); }
string& get() { /* huge code here */ return s; }
private:
string s;
};
Run Code Online (Sandbox Code Playgroud)
我得到的错误是:
passing ‘const A’ as ‘this’ argument of
‘std::string& A::get()’ discards qualifiers
Run Code Online (Sandbox Code Playgroud)
我明白问题是什么,但我该如何解决呢?我真的需要has()是const.谢谢.