小编sre*_*127的帖子

Android ImageView连续放大和缩小

有没有办法ImageView在Android中连续放大和缩小.我尝试使用下面的代码,但只有一个Zoom功能正常工作.

zoomin.xml

    <?xml version="1.0" encoding="utf-8"?>
    <set xmlns:android="http://schemas.android.com/apk/res/android"
    android:fillAfter="true" > 
    <scale
        xmlns:android="http://schemas.android.com/apk/res/android"
        android:duration="20000"
        android:fromXScale="1"
        android:fromYScale="1"
        android:pivotX="50%"
        android:pivotY="50%"
        android:toXScale="3"
        android:toYScale="3" >
    </scale>

</set>
Run Code Online (Sandbox Code Playgroud)

zoomout.xml

    <?xml version="1.0" encoding="utf-8"?>
    <set xmlns:android="http://schemas.android.com/apk/res/android"
    android:fillAfter="true" > 
    <scale
        xmlns:android="http://schemas.android.com/apk/res/android"
        android:duration="20000"
        android:fromXScale="1.0"
        android:fromYScale="1.0"
        android:pivotX="50%"
        android:pivotY="50%"
        android:toXScale="0.5"
        android:toYScale="0.5" >
    </scale>

</set>
Run Code Online (Sandbox Code Playgroud)

Activity上课:

Animation zoomin, zoomout; //declared as public

@Override
public void onCreate(Bundle savedInstanceState) {
   // animation
    zoomin = AnimationUtils.loadAnimation(this, R.anim.zoomin);
    zoomout = AnimationUtils.loadAnimation(this, R.anim.zoomout);
    bgImage.setAnimation(zoomin);
    bgImage.setAnimation(zoomout);
    Thread t = new Thread(new Zoom());
    t.start();
}
private class …
Run Code Online (Sandbox Code Playgroud)

animation android imageview

13
推荐指数
1
解决办法
1万
查看次数

从纪元时间/时间戳中删除毫秒 | 爪哇

我有一个纪元时间,我想将其转换为 sql 时间戳。我可以使用以下代码从纪元中提取实际时间:

String time = "1351504294";
long t = Long.parseLong(time);
Timestamp ts = new Timestamp(t*1000);
Run Code Online (Sandbox Code Playgroud)

我得到的输出是:2012-10-29 09:58:50.0。但是当我尝试将其插入表中时,由于毫秒部分“09:58:50.0”,它显示错误。如何从时间戳中删除毫秒部分?

java timestamp epoch unix-timestamp

4
推荐指数
1
解决办法
3万
查看次数

Servlet - 将响应导出到 Excel 文件

我无法将响应从 servlet 导出到 excel 文件。请看下面的代码:

测试.java:

 @Override
public void doPost(HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException {
response.setContentType("text/html");
out = response.getWriter();
out.print("<form name=\"test\" method=\"post\" action=\"Export\">");
out.print("<table border=\"1\" cellpadding=\"3\" bordercolor='black'");
out.print("<tr>");
out.print("<td>1</td>");
out.print("<td>hello how are you?</td>");
out.print("</tr>");
out.print("</table>");
out.print("<td><input type=\"submit\" name =\"submit1\" value=\"Export To Excel\"></td>");
out.print("</form>");
Run Code Online (Sandbox Code Playgroud)

单击提交按钮时会生成一个不包含任何值的 Excel 工作表。查看Export.java单击提交按钮时调用的 。

导出.java

public class Export extends HttpServlet {

@Override
public void doPost(HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException {
    String submit1 = request.getParameter("submit1");
   if (submit1 != null) {
        response.setContentType("application/vnd.ms-excel");
        response.setHeader("Content-Disposition", …
Run Code Online (Sandbox Code Playgroud)

java excel jsp servlets response

3
推荐指数
1
解决办法
4万
查看次数

在java中执行linux终端命令?

我正在尝试从java执行SOX命令,但不幸的是它每次都返回一个错误.其他每个SOX命令都运行得很好!! 这是代码:

class Simple {
    public static void main(String args[]) throws IOException, Exception {
        Process p;
        BufferedReader br;
        String co = "sox speech_16.wav -p pad 0 2.5 | sox - -m speech_16.wav speech_output.wav";
        p = Runtime.getRuntime().exec(co);
        br = new BufferedReader(new InputStreamReader(p.getInputStream()));
            int returnCode = p.waitFor();
        System.out.println("reurn code : "+returnCode);         
    }
}
Run Code Online (Sandbox Code Playgroud)

当我在终端中执行相同的sox命令时,它工作正常.我真的无法理解问题是什么!是因为'|' 符号??

java linux sox

2
推荐指数
1
解决办法
4855
查看次数