小编Sco*_*ion的帖子

在td里面的Html表tr

我正在尝试用HTML创建一个表.我有以下设计要创建.我在<tr>内部添加了一个<td>但不知何故,表格不是按照设计创建的.

在此输入图像描述

任何人都可以建议我如何实现这一目标?

我无法创建Name1 | 价格1节.

html html-table

80
推荐指数
7
解决办法
20万
查看次数

在Android中逐帧动画导致OutOfMemoryError

我在我的资源/可绘制文件夹中有很多图像作为帧(比如大约200).使用这个图像我想运行动画.最长的动画是80Frames.我成功地能够通过单击某些按钮来运行动画,但对于某些动画,它给了我OutOfMemoryError,说VM无法提供这样的内存.它超出了VM预算.我计算所有图像的大小约10MB.每个图像的大小为320x480像素.

我尝试谷歌搜索,发现我需要使用System.gc()方法显式调用垃圾收集器.我已经做到了,但我仍然得到一些时间错误的记忆.任何人都可以请帮助我.

一些代码: -

ImageView img = (ImageView)findViewById(R.id.xxx);
img.setBackgroundResource(R.anim.angry_tail_animation);
AnimationDrawable mailAnimation = (AnimationDrawable) img.getBackground();
MediaPlayer player = MediaPlayer.create(this.getApplicationContext(), R.raw.angry);
    if(mailAnimation.isRunning()) {
    mailAnimation.stop();
    mailAnimation.start();
        if (player.isPlaying()) {
        player.stop();
        player.start();
    }
    else {
        player.start();
    }
}
else {
    mailAnimation.start();
        if (player.isPlaying()) {
        player.stop();
        player.start();
    }
    else {
        player.start();
    }
}
Run Code Online (Sandbox Code Playgroud)

这是我在点击按钮时编写的代码.....

res/drawable/anim中的资源文件

<?xml version="1.0" encoding="utf-8"?>
<animation-list xmlns:android="http://schemas.android.com/apk/res/android"
android:oneshot="true" >

<item android:drawable="@drawable/cat_angry0000" android:duration="50"/>

<item android:drawable="@drawable/cat_angry0001" android:duration="50"/>

<item android:drawable="@drawable/cat_angry0002" android:duration="50"/>

<item android:drawable="@drawable/cat_angry0003" android:duration="50"/>

<item android:drawable="@drawable/cat_angry0004" android:duration="50"/>

<item android:drawable="@drawable/cat_angry0005" android:duration="50"/>

<item android:drawable="@drawable/cat_angry0006" android:duration="50"/>

<item android:drawable="@drawable/cat_angry0007" …
Run Code Online (Sandbox Code Playgroud)

animation android memory-leaks out-of-memory

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

以Java形式获取当前周开始日期和结束日期 - (星期一至星期日)

今天是2014-04-06(星期天).

我使用以下代码得到的输出是:

Start Date = 2014-04-07
End Date = 2014-04-13
Run Code Online (Sandbox Code Playgroud)

这是我想要的输出:

Start Date = 2014-03-31
End Date = 2014-04-06
Run Code Online (Sandbox Code Playgroud)

我怎样才能做到这一点?

这是我到目前为止完成的代码:

// Get calendar set to current date and time
Calendar c = GregorianCalendar.getInstance();

System.out.println("Current week = " + Calendar.DAY_OF_WEEK);

// Set the calendar to monday of the current week
c.set(Calendar.DAY_OF_WEEK, Calendar.MONDAY);
System.out.println("Current week = " + Calendar.DAY_OF_WEEK);

// Print dates of the current week starting on Monday
DateFormat df = new SimpleDateFormat("yyyy-MM-dd", Locale.getDefault());
String startDate = "", endDate = …
Run Code Online (Sandbox Code Playgroud)

java date dayofweek

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

在Google Maps V2 Android上按用户指示旋转标记

我想根据从Accelerometer接收的轴承或传感器值来旋转标记,以向用户显示他实际移动的位置.我已将标记图标和平面值设置为true,但它不能按要求工作.

mCurrentLocationMarker.position(new LatLng(
                            LocationUtils.sLatitude, LocationUtils.sLongitude));
                    mCurrentLocationMarker.icon(icon);
                    mCurrentLocationMarker.flat(true);
                    mCurrentLocationMarker.rotation(LocationUtils.sBearing);

                    if (currentMarker != null) {
                        currentMarker.setPosition(new LatLng(
                                LocationUtils.sLatitude,
                                LocationUtils.sLongitude));
                    } else {
                        currentMarker = mGoogleMap
                                .addMarker(mCurrentLocationMarker);
                    }
                    animateCameraTo(true);
Run Code Online (Sandbox Code Playgroud)

我用过这个 标记 作为标记.

我不知道为什么它不按照用户的指示旋转.如果有任何人有任何想法,请在我犯错的地方帮助我.

LocationUtils.sBearing是我从onLocationChanged或accelerometer收到的Bearing的值.

基本上我想让我的标记与谷歌地图标记一样,向用户显示他们正在移动或转向的方向.

android accelerometer bearing marker google-maps-markers

18
推荐指数
2
解决办法
2万
查看次数

如何从Google Places API获得20+结果?

我正在开发一个应用程序,我在其中获取用户附近的ATM列表.为此,我使用的是Google Places API,但每次只返回20个结果.我希望得到更多结果.在API文档中提到它将返回20个结果,但我想知道有什么方法可以获得更多数据,或者我必须为此创建自己的数据库?我在API中发现的是它没有印度的所有ATM.某些位置的信息也不准确.那么请告诉我一些想法,我应该使用自己的数据库?我知道我可以在Google地方信息中注册地点,但问题是每次只返回20个结果; 如果无论如何这个问题都解决了,那么使用Places API会很棒.

请帮助我.....

android google-places-api google-places

17
推荐指数
3
解决办法
5万
查看次数

如何在Liferay中使用Ajax请求提交表单?

我是liferay门户网站的新手.我在liferay中开发了一个用于演示的portlet.我在这个例子中使用了port portlet通信.我正在做的是: - 我有一个搜索portlet,其中我有一个文本字段用于搜索.当我点击搜索按钮时,它从数据库中获取数据并使用另一个portlet中包含的搜索显示该数据.我为这个项目使用了ProcessEvent和ActionEvent批注.

现在我想要的是当我点击搜索按钮然后页面不应该刷新(即我希望使用AJAX的概念)并且数据应该显示在另一个portlet上.

代码片段

Portlet A - view.jsp

<%@include file="/html/init.jsp"%>
<portlet:defineObjects />

<!--

<portlet:actionURL var="actionURL" name="pitchBall"></portlet:actionURL>

//-->
**Change to Resource URL**
<portlet:resourceURL var="resourceURL">
</portlet:resourceURL>


<aui:form method="POST" action="<%= resourceURL%>" name="    <portlet:namespace>fm1</portlet:namespace>">
    <aui:input name="search" id="search" />
    <aui:button type="submit" name="Search" value="Search" />
</aui:form>
Run Code Online (Sandbox Code Playgroud)

Portlet A - SearchPortlet类

package com.test;

/**
 * Portlet implementation class SearchPortlet
 */
public class SearchPortlet extends GenericPortlet {

    @Override
    public void render(RenderRequest request, RenderResponse response)
            throws PortletException, IOException {
        // TODO Auto-generated method stub
        super.render(request, response);

    } …
Run Code Online (Sandbox Code Playgroud)

ajax liferay liferay-6

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

在Android中的EditText左侧设置图像

我有一个联系表单,我想在我的编辑文本中添加一些图标以便更好地查看.我想创建类似下面的EditText.

在此输入图像描述

我有如下的EditText.我得到了类似的结果.我希望图像绝对在左侧,就像在上面的图像中一样.我知道内部EditText正在使用Nine Patch图像,我认为这就是为什么结果有些不同.谁能知道如何解决这个问题?

在此输入图像描述

<EditText
            android:id="@+id/name"
            android:layout_width="fill_parent"
            android:layout_height="51dip"
            android:hint="@string/name"
            android:inputType="text"
            android:drawableLeft="@drawable/name_icon_edittext" />
Run Code Online (Sandbox Code Playgroud)

android drawable android-edittext

14
推荐指数
2
解决办法
3万
查看次数

从ArrayList <CustomObject>中查找项目索引的更好方法

首先,如果我错了,请纠正我.我想在ArrayList<CustomType>不使用For循环的情况下找到Item的索引(即字符串值).

POJO:

id;
name;
Run Code Online (Sandbox Code Playgroud)

码:

ArrayList<POJO> list = new ArrayList<POJO>;

//Lots of data added to these list...
Run Code Online (Sandbox Code Playgroud)

现在我想从arraylist中找到特定名称的id而不使用下面的for循环.

String id = null;
// TODO Auto-generated method stub
for (int i = 0; i < list.size(); i++) {
    if("ABCD".equalsIgnoreCase(list.get(i).getName())) {
        id = list.get(i).getId();
        break;
    }
}
Run Code Online (Sandbox Code Playgroud)

理想情况下,我不想实现For循环,因为在某些情况下,我在List中有500多个数据,并且使用For循环查找索引不是一个好方法.

java search arraylist indexof

11
推荐指数
2
解决办法
2万
查看次数

发布未知的位图参考 - 在android中设置标记

代码: -

    /**
     * Update marker position and icon
     */
    private void setMarker() {
        synchronized (OBJ_LOCK) {
            if (mLatitude != 0.0 || mLongitude != 0.0) {
                mRotatedBitmap = rotateBitmap(mOriginalMarkerBitmap, mBearing);

                if (mRotatedBitmap != null) {
                    mCurrentPositionIcon = BitmapDescriptorFactory
                            .fromBitmap(mRotatedBitmap);
                    mCurrentLocationMarker.position(new LatLng(mLatitude,
                            mLongitude));

                    mCurrentLocationMarker.icon(mCurrentPositionIcon);
                    mCurrentLocationMarker.anchor(0.5f, 0.5f);

                    if (currentMarker != null && mCurrentPositionIcon != null) {
                        currentMarker.setIcon(mCurrentPositionIcon);
                        currentMarker.setAnchor(0.5f, 0.5f);
                        currentMarker.setPosition(new LatLng(mLatitude,
                                mLongitude));
                    } else {
                        currentMarker = mGoogleMap
                                .addMarker(mCurrentLocationMarker);
                    }
                }
            }
        }
    }
Run Code Online (Sandbox Code Playgroud)

logcat-

02-03 14:28:53.621: E/AndroidRuntime(28639): FATAL EXCEPTION: main
02-03 …
Run Code Online (Sandbox Code Playgroud)

android google-maps bitmap marker

11
推荐指数
1
解决办法
7330
查看次数

如何使用Android中的AnimationDrawable或AnimationUtils从SD CARD加载图像并运行动画

我正在将图像存储在SD卡中并使用我希望运行动画的图像.我正在使用以下代码,但我的动画根本不起作用.

代码片段

playAnimation("xxx", medid, 25);//calling method
break;

public void playAnimation(String string, int medid2, int length) {
        // TODO Auto-generated method stub
        animation = new AnimationDrawable();
        Bitmap bitMap;
    BitmapFactory.Options options = new BitmapFactory.Options();
    options.inSampleSize = 2; //reduce quality
        player = MediaPlayer.create(this.getApplicationContext(), medid2);
        try {
            for (int i = 0; i <= length; i++) {
                System.out.println("File Name : - " + Environment.getExternalStorageDirectory().toString() + "/" + string + i);
                bitMap = BitmapFactory.decodeFile(Environment.getExternalStorageDirectory().toString() + "/" + string + i);
                Drawable bmp = new BitmapDrawable(bitMap); …
Run Code Online (Sandbox Code Playgroud)

animation sd-card android-animation android-imageview

9
推荐指数
1
解决办法
1597
查看次数