我有一个表单位于几个Twitter的Bootstrap选项卡上:
<form id="personal-data" class="form-horizontal">
<div class="tabbable">
<ul id="tab" class="nav nav-tabs">
<li class="active"><a href="#home" data-toggle="tab">Home</a></li>
<li class=""><a href="#profile" data-toggle="tab">Profile</a></li>
<!-- ... -->
</ul>
<div id="myTabContent" class="tab-content">
<div class="tab-pane fade active in" id="home">
<fieldset>
<div class="control-group">
<div class="controls">
<input type="text" id="field1">
</div>
</div>
</fieldset>
</div>
<div class="tab-pane fade" id="profile">
<fieldset>
<div class="control-group">
<div class="controls">
<input type="text" id="field2">
</div>
</div>
</fieldset>
</div>
Run Code Online (Sandbox Code Playgroud)
当我valid在活动选项卡上使用jQuery验证表单时,在同一选项卡上使用无效值的字段,则验证失败(这是正确的).但是当我在一个选项卡上并且另一个选项卡上的值无效时,验证将返回true,这是不正确的.我该如何解决?如何在另一个标签上突出显示该字段?
请参阅本演示(只需按下按钮,旁边 -它会显示错误信息,然后转到最后一个标签,然后按完成那里).
我有以下代码:
private Toast movieRecordToast;
private void displayNextMovie() {
if (movieRecordToast != null) movieRecordToast.cancel(); // cancel previous Toast (if user changes movies too often)
movieRecordToast = Toast.makeText(getApplicationContext(), "Next", Toast.LENGTH_SHORT);
movieRecordToast.show();
private void displayPrevMovie() {
if (movieRecordToast != null) movieRecordToast.cancel();
movieRecordToast = Toast.makeText(getApplicationContext(), "Prev", Toast.LENGTH_SHORT);
movieRecordToast.show();
Run Code Online (Sandbox Code Playgroud)
但如果displayNextMovie被快速调用几次然后displayPrevMovie被调用,"Next"Toast仍会显示,并且只有在显示"Prev"之后.看起来取消无法正常工作.
一旦第一次启动应用程序,我需要向SQLite数据库添加初始值.我该怎么办?
我怎么能抓到这样的事件?onCreateContextMenu很相似,但我不需要菜单.
我已经下载了python-Levenshtein档案并提取了Levenshtein目录.所以,结果我有以下文件结构:
Levenshtein
- __init__.py
- _levenshtein.c
- _levenshtein.h
- StringMatcher.py
myscript.py
Run Code Online (Sandbox Code Playgroud)
以下myscript.py内容:
from Levenshtein import *
from warnings import warn
print Levenshtein.distance(string1, string2)
Run Code Online (Sandbox Code Playgroud)
但是我收到以下错误 -
Traceback (most recent call last):
File "myscript.py", line 1, in <module>
from Levenshtein import *
File "/path/to/myscript/Levenshtein/__init__.py", line 1, in <module>
from Levenshtein import _levenshtein
ImportError: cannot import name _levenshtein
Run Code Online (Sandbox Code Playgroud)
这有什么不对?
我有以下设置 -
文件夹结构:
myapp
- conf
- locale
- ru
- LC_MESSAGES
- django.mo # contains "This is the title." translation
- django.po
- templates
- index.html
setting.py
main.py
Run Code Online (Sandbox Code Playgroud)
app.yaml:
...
env_variables:
DJANGO_SETTINGS_MODULE: 'settings'
handlers:
...
- url: /locale/ # do I need this?
static_dir: templates/locale
libraries:
- name: django
version: "1.5"
Run Code Online (Sandbox Code Playgroud)
settings.py:
USE_I18N = True
LANGUAGES = (
('en', 'EN'),
('ru', 'RU'),
)
LANGUAGE_CODE = 'ru'
LANGUAGE_COOKIE_NAME = 'django_language'
SECRET_KEY = 'some-dummy-value'
MIDDLEWARE_CLASSES = (
'django.middleware.locale.LocaleMiddleware' …Run Code Online (Sandbox Code Playgroud) 这是代码:
public class BillingService extends Service implements ServiceConnection {
...
@Override
public void onStart(Intent intent, int startId) {
handleCommand(intent, startId); // line 361
}
/**
* The {@link BillingReceiver} sends messages to this service using intents.
* Each intent has an action and some extra arguments specific to that action.
* @param intent the intent containing one of the supported actions
* @param startId an identifier for the invocation instance of this service
*/
public void handleCommand(Intent intent, int startId) …Run Code Online (Sandbox Code Playgroud) 我TextSwitcher的每个记录ListView应显示第一个值(text1),然后显示另一个值(text2),然后再显示第一个值,依此类推.只有当text2不为空时才会发生.否则,应始终显示text1(不进行任何更改和动画).
我创建了Runnable(),它改变了布尔变量(time2)然后调用items.notifyDataSetChanged().它按预期工作,结果setViewValue()我ListView被称为.
这是代码:
items.setViewBinder(new SimpleCursorAdapter.ViewBinder() {
@Override
public boolean setViewValue(View view, Cursor cursor, int columnIndex) {
int viewId = view.getId();
switch(viewId) {
case R.id.timetext:
TextSwitcher itemTime = (TextSwitcher) view;
if (itemTime.getChildCount() != 2) {
itemTime.removeAllViews();
itemTime.setFactory(new ViewSwitcher.ViewFactory() {
@Override
public View makeView() {
TextView t = new TextView(MyActivity.this);
t.setTextSize(18);
t.setTypeface(null, Typeface.BOLD);
t.setTextColor(Color.WHITE);
return t;
}
});
itemTime.setAnimateFirstView(true);
itemTime.setInAnimation(AnimationUtils.loadAnimation(MyActivity.this, …Run Code Online (Sandbox Code Playgroud) 我在TextView中有链接:
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
...
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:autoLink="all"
android:linksClickable="true"
android:text="@string/app_description" />
</RelativeLayout>
Run Code Online (Sandbox Code Playgroud)
该链接是资源的一部分:
<?xml version="1.0" encoding="utf-8"?>
<resources>
...
<string name="app_description">Some text with the <a href="http://www.example.com">link</a>.</string>
</resources>
Run Code Online (Sandbox Code Playgroud)
不知何故,链接不起作用.可能是什么原因?它显示为链接.但是点击不会打开浏览器.
班级代码:
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
Run Code Online (Sandbox Code Playgroud) android ×7
python ×2
sqlite ×2
django ×1
django-1.5 ×1
hyperlink ×1
java ×1
javascript ×1
jquery ×1
osx-yosemite ×1
python-2.7 ×1
service ×1
sms ×1
sql ×1
tabs ×1
textview ×1
toast ×1