我有一个DataTemplate用来显示一个类的详细信息ListBox.在DataTemplate具有EventTrigger附接至该项目的Loaded一个使用事件DoubleAnimation的每个项目淡入视图,因为它们将被添加到ObservableCollection绑定到ListBox.它还有一个DataTrigger使用a DoubleAnimation和a ColorAnimation(RepeatBehavior="Forever")在特定条件下为发光效果设置动画.到现在为止还挺好.
该应用程序要求每隔几秒更新一次项属性.ListBox在调用时更新项目的属性后出现问题ListBox.Items.Refresh().这将重置动画,以便每个项目淡入视图,并且每隔几秒钟重新开始发光效果.如果我不调用,则item属性值不会更新Refresh.我的问题是,有没有办法单独刷新每个项目或以某种方式解决这个问题?
我有一个网站,我想自动刷新,如果用户没有在特定时间(即180秒)使用它.有没有办法自动刷新HTML只有在页面上没有活动?
谢谢!
我有以下UpdatePanel从ashx处理程序获取图像,所有这些都在页面刷新时正常工作.但是,当计时器触发时,标签会以当前时间刷新,但不会刷新图像.
<asp:UpdatePanel runat="server" id="TimedPanel" UpdateMode="Conditional">
<ContentTemplate>
<asp:Image ID="Image1" runat="server" Height="218px"
ImageUrl="~/getImage.ashx?cam=1" Width="303px" BorderWidth="10px" />
<asp:Timer ID="UpdateTimer" runat="server" interval="1250"
ontick="UpdateTimer_Tick" />
<asp:Label ID="DateStampLabel" runat="server" />
</ContentTemplate>
<Triggers>
<asp:AsyncPostBackTrigger controlid="UpdateTimer" eventname="Tick" />
</Triggers>
</asp:UpdatePanel>
Run Code Online (Sandbox Code Playgroud)
计时器例程是:
protected void UpdateTimer_Tick(object sender, EventArgs e)
{
DateStampLabel.Text = DateTime.Now.ToString();
}
Run Code Online (Sandbox Code Playgroud)
为什么图像不刷新?
当我想在surfaceview上显示普通视图对象时,我遇到了问题.问题是:如果我在布局xml文件中将普通视图的可见性设置为不可见,则视图的刷新不正确 - 无法更新视图和曲面视图的重叠区域.如果我将普通视图的可见性设置为在布局xml中可见,则没有问题.
这是我的测试代码:
package com.test;
import java.io.IOException;
import android.app.Activity;
import android.media.MediaPlayer;
import android.media.MediaPlayer.OnPreparedListener;
import android.os.Bundle;
import android.os.Handler;
import android.os.Message;
import android.util.Log;
import android.view.SurfaceHolder;
import android.view.SurfaceHolder.Callback;
import android.view.SurfaceView;
import android.view.View;
import android.widget.LinearLayout;
public class TESTActivity extends Activity implements Callback, OnPreparedListener {
private SurfaceView mSurface1;
private SurfaceHolder mSurfaceHolder1;
private MediaPlayer mMediaPlayer1;
private LinearLayout mLayout;
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
mLayout = (LinearLayout) findViewById(R.id.channel_subscribe);
new Handler() {
@Override
public void …Run Code Online (Sandbox Code Playgroud) 当我更新GAE数据存储区时,只有在浏览器刷新页面后才会显示正确的数据存储区内容:
import os
from google.appengine.ext.webapp import template
from google.appengine.ext import db
import webapp2
#def testkey():
# return db.Key.from_path('test', 'test')
class TestEntity(db.Model):
testkey = db.StringProperty(multiline=False)
testvalue = db.StringProperty(multiline=False)
class TestRefreshProblem(webapp2.RequestHandler):
def get(self):
testquery = TestEntity.all()#.ancestor(testkey())
entities = testquery.run()
template_values = {
'entities': entities,
}
path = os.path.join(os.path.dirname(__file__), 'index.html')
self.response.out.write(template.render(path, template_values))
class TestRefreshProblemPost(webapp2.RequestHandler):
def post(self):
# testEntity = TestEntity(parent=testkey())
testEntity = TestEntity()
testEntity.testkey = self.request.get('testkey')
testEntity.testvalue = self.request.get('testvalue')
testEntity.put()
self.redirect('/')
app = webapp2.WSGIApplication([
('/', TestRefreshProblem),
('/pst', TestRefreshProblemPost)
], debug=True)
Run Code Online (Sandbox Code Playgroud)
和index.html是:
<html>
<body> …Run Code Online (Sandbox Code Playgroud) python google-app-engine refresh ancestor google-cloud-datastore
嗨,我有一个刷新图像的问题,添加到JLabel.它类似于控制灯,可以在线/离线提供有关状态的信息.当我们启动应用程序并启用服务器时,它将调用此方法并将指示灯变为绿色.我们当然可以点击"离线"按钮,让它一直处于脱机状态.然后灯是红色的.到目前为止一切正常,但是当我们点击"上线"时,程序在线,但图像仍然是红色的.在每个地方,它都用同样的方法调用.只是这种灯不起作用,因为连接和断开工作正常.
我给你一些代码:
只改变图像的方法:
public void changeLight(String name){
BufferedImage imgtmp;
try {
System.out.println("CHANGE LIGHT: "+name);
imgtmp = ImageIO.read(new File(name));
panelMenuOnline.remove(panelMenuOnlineLight);
panelMenuOnlineLight = new JLabel(new ImageIcon(imgtmp));
panelMenuOnline.add(panelMenuOnlineLight);
} catch (IOException e) {
e.printStackTrace();
}
}
Run Code Online (Sandbox Code Playgroud)
同一类中的按钮定义:
panelMenuButOn = new Guzik("GO ONLINE"){
@Override
public void actionPerformed(ActionEvent e) {
if(!Pang.game.online){
Pang.game.haveToBeOffline = false;
if(Client.checkConnection()) {
JOptionPane.showMessageDialog(this,
"Successfully connected");
Pang.game.online=true;
changeLight(imgGREEN);
} else {
JOptionPane.showMessageDialog(this,
"Connection refused");
}
} else {
JOptionPane.showMessageDialog(this,
"Successfully disconnected");
setText("GO ONLINE");
Pang.game.haveToBeOffline = true;
Pang.game.online=false;
changeLight(imgRED);
}
} …Run Code Online (Sandbox Code Playgroud) 这是我的布局xml.
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/garae_scroll"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@color/background"
android:fillViewport="true"
android:focusableInTouchMode="false" >
<RelativeLayout>
...
<com.handmark.pulltorefresh.library.PullToRefreshScrollView>
<LinearLayout/>
</com.handmark.pulltorefresh.library.PullToRefreshScrollView>
</RelativeLayout>
</ScrollView>
Run Code Online (Sandbox Code Playgroud)
我已经在这个链接中尝试了解决方案: ScrollView Inside ScrollView
但是,它没有用.如何使用子PullToRefreshScrollView?请帮我.
实践证明,这个社区对我的个人和学校项目非常有帮助,因此我决定加入。这是我的第一个问题。目前,我在夏季的空闲时间正在构建一个Android应用程序。我试图在我的应用程序的一个片段中实现SwipeRefreshLayout,但是由于未知原因,当我进行刷新时,我似乎无法让我的片段调用OnRefresh()方法。
这是我的Java代码:
import android.app.Fragment;
import android.content.Context;
import android.net.Uri;
import android.os.Bundle;
import android.support.v4.widget.SwipeRefreshLayout;
import android.support.v4.widget.SwipeRefreshLayout.OnRefreshListener;
import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import com.parse.FindCallback;
import com.parse.ParseException;
import com.parse.ParseObject;
import com.parse.ParseQuery;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
public class Notifications extends Fragment implements OnRefreshListener{
private OnFragmentInteractionListener mListener;
private RecyclerView mRecyclerView;
private RecyclerView.Adapter mAdapter;
private RecyclerView.LayoutManager mLayoutManager;
private SwipeRefreshLayout swipeLayout;
private View view;
public Notifications() {
}
public static Notifications newInstance() {
Notifications fragment = new Notifications();
Bundle …Run Code Online (Sandbox Code Playgroud) 因此,我有一个DIV元素,当按下该元素时,我想在其他窗口中打开一个新选项卡。唯一的问题是,每当刷新页面或按下任何其他div元素时,该函数也会同时启动并在另一个窗口中打开页面。我将在下面包含我的代码,但是我不确定为什么会onClick={window.open("https://www.thechinesewriter.com")像我所说的那样出现这种情况,我只希望在按下div时打开一个新标签页,而不是在单击页面,甚至刷新页面本身。
import React from "react";
import "./Column1.css";
class Column1 extends React.Component {
render() {
return(
<React.Fragment>
<div className="rectImage">
<img className="imagePost" src={this.props.image} />
</div>
<div onClick={window.open("https://www.thechinesewriter.com")} className="downloadBut1">
<h2>
Source
</h2>
</div>
<div className="downloadBut2">
<h2>
Repository
</h2>
</div>
</React.Fragment>
)
}
}
export default Column1;
Run Code Online (Sandbox Code Playgroud) refresh ×10
android ×3
image ×2
java ×2
javascript ×2
layout ×2
ancestor ×1
asp.net ×1
c# ×1
jlabel ×1
listbox ×1
listboxitem ×1
mysql ×1
onclick ×1
option ×1
overlay ×1
php ×1
pull ×1
python ×1
reactjs ×1
scrollview ×1
surfaceview ×1
swing ×1
updatepanel ×1
window.open ×1
wpf ×1
xml ×1