我在片段类中有一个listview,它从JSON获取数据.到目前为止,我能够在列表视图中显示数据.(这里的数据是新闻项目).我想在列表视图中点击特定新闻时显示新闻的详细页面.
例如:列表视图仅包含新闻的标题和图像.单击该列表视图时,它应显示该特定新闻片段的详细版本.我怎样才能做到这一点?
这是具有Listview的片段类.
package com.fortuna.cinemalk;
import java.util.ArrayList;
import android.app.Activity;
import android.app.FragmentManager;
import android.os.AsyncTask;
import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentTransaction;
import android.view.LayoutInflater;
import android.view.View;
import android.view.View.OnClickListener;
import android.view.ViewGroup;
import android.widget.AdapterView.OnItemClickListener;
import android.widget.GridView;
import android.widget.ListView;
import android.content.Intent;
import android.widget.AdapterView;
import com.fortuna.cinemalk.adapter.LazyAdapter;
import com.fortuna.cinemalk.model.BaseElement;
import com.fortuna.cinemalk.service.CommonVariable;
import com.fortuna.cinemalk.service.JSONServices;
import com.fortuna.cinemalk.util.Element;
public class NewsFramgment extends Fragment {
private GridView gridView;
private ListView listView;
private ArrayList<BaseElement> News;
private LazyAdapter adapter;
private Activity activity;
private CommonVariable commonVariable;
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) …Run Code Online (Sandbox Code Playgroud) 我正在研究一个贷款计算器,我使用离子范围滑块来选择贷款金额、利率、贷款期限等。还有一个每月支付范围。当贷款金额、利率和期限发生变化时,这个月还款范围应该像这样计算。
(loanamount*interest rate)/loan duration
Run Code Online (Sandbox Code Playgroud)
因此,当我们更改贷款金额、利率和贷款期限时,基本上每月还款范围应该会发生变化。我怎样才能做到这一点?
到目前为止我的代码:
<content has-header="true">
<div class="item item-divider">
Select your Loan Amount :
</div>
<div class="item range">
<div id='slider'>
<input type="range" name="number" min="100" max="1000000" step="100.00" ng-model="loanAmount">
<font color="#009ACD"><b>Loan Amount:</b></font> <input type="text" ng-model="loanAmount" min="100" max="1000000" />
</div>
</div>
<div class="item item-divider">
Select your Interest Rate:
</div>
<div class="item range">
<div id='slider'>
<input type="range" name="volume" min="0" max="100" step="0.01" ng-model="interestRate">
<font color="#009ACD"><b>Interest Rate:</b></font> <input type="text" ng-model="interestRate" min="0" max="100" />
</div>
</div>
<div class="item item-divider">
Select your Loan Term :
</div> …Run Code Online (Sandbox Code Playgroud) 我在我的html页面中使用离子范围来设置月数.它看起来像这样

我希望这可以在我滑动离子范围时显示数年和数月.例如:第一个月达到12并自动成为一年.我怎么能实现这一目标?
我的离子范围的html代码
<p><label class="labelCalhead"> Select your Loan Term :</label></p>
<div class="item range">
<input type="range" name="volume" min="1" max="30" ng-model="loanTerm" ></div>
<label class="labelCal">Monthly</label>
<p><input type="text" decimal-places ng-model="loanTerm" onkeypress='return event.charCode >= 48 && event.charCode <= 57 || event.charCode == 46' min="0" max="30" STYLE="color: #72A4D2; " /></p><br>
Run Code Online (Sandbox Code Playgroud)
要精确,我想做这样的事情

我正在尝试在单击某个输入字段时显示叠加层.我这样反应.我怎样才能做到这一点?
这是我的代码
import React, { Component } from 'react';
import cam from '../../Resources/img/cam.png';
import SinglePost from '../../Components/Post/single_post';
class Middle extends Component {
constructor(props) {
super(props);
this.state = {
posts: []
}
}
render() {
function popup_ques(e) {
e.preventDefault();
alert("now the overlay should appear");
}
return (
<div className="middle_div">
<input className='post_data_input' placeholder="Ask your question here" ref="postTxt" onClick={popup_ques}/>
</div>
);
}
}
export default Middle;
Run Code Online (Sandbox Code Playgroud)
我应该采取什么方法?
我已经使用CSS编写了自己的模态类,并在我的应用程序中成功使用了它。但是我面临的问题是当覆盖层打开时,我仍然可以滚动背景内容。打开模态/叠加时如何停止滚动背景内容?
这是我的模式,它在叠加层的顶部打开
<div>
<div className="overlay"></div>
{this.props.openModal ?
<div>
<div className="polaroid sixten allcmnt_bg_clr horiz_center2">
{}
<div className="mobile_header">
<PostHeader/>
</div>
<div className="mobile_renderPost">
{ this.renderPostType() }
</div>
<div className="mobile_post_bottom"></div>
</div>
</div> : null}
</div>
Run Code Online (Sandbox Code Playgroud)
我的叠加CSS
.overlay {
background-color: rgba(0, 0, 0, .70);
position: fixed;
width: 100%;
height: 100%;
opacity: 1;
left: 0;
right: 0;
-webkit-transition: opacity .25s ease;
z-index: 1001;
margin: 0 auto;
}
Run Code Online (Sandbox Code Playgroud) 当您按下Android设备中的硬件后退按钮退出phonegap/ionic应用程序时,有没有办法显示确认弹出窗口?
在当前状态下,我的应用程序在单击后退按钮后继续前一个状态.
在应用程序中,无论您在何处按下后退按钮,都有办法退出应用程序吗?
我找到了这段代码,但似乎没有用:
$ionicPlatform.registerBackButtonAction(function() {
var confirmPopup = $ionicPopup.confirm({
title: 'Sign Out Confirm',
template: 'Are you sure you want to Logout?'
});
confirmPopup.then(function(res) {
if (res) {
$rootScope.rootScopeUserTransactionPassword = null;
$state.go('app.playlists');
} else {
console.log('You are not sure');
}
});
}, 100);
Run Code Online (Sandbox Code Playgroud) 我按照教程进行操作
https://developers.google.com/maps/documentation/android/start
Run Code Online (Sandbox Code Playgroud)
我设法将地图加载到我的应用程序中.现在我想使用纬度和经度将一些标记添加到我的应用程序中.我该怎么办?我尝试了一些东西,但没有奏效.我试过的代码如下.
这是我要怎么做的.但我得到一个零点异常.这是什么原因?
GoogleMap googleMap = null;
MapFragment fm = (MapFragment) (activity.getFragmentManager())
.findFragmentById(R.id.map);
googleMap = fm.getMap();
double latitude = 7.421226;
double longitude =80.401264 ;
// create marker
MarkerOptions marker = new MarkerOptions().position(new LatLng(latitude, longitude)).title("Hello Maps ");
// adding marker
googleMap.addMarker(marker);
Run Code Online (Sandbox Code Playgroud)
我的布局
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:id="@+id/filmhall"
android:background="@color/grey" >
<fragment
android:id="@+id/map"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:name="com.google.android.gms.maps.SupportMapFragment"/>
</LinearLayout>
Run Code Online (Sandbox Code Playgroud) 我有这个文本字段,我需要阻止用户输入超过允许的字符.让我们说我希望用户只键入10个字符,如果他输入更多文本字段将不会采取它.它必须在达到字符限制后停止获取输入..
我知道有ng-maxlength但它不会阻止用户输入超过允许的字符,虽然我可以给出一个错误信息.有没有办法做到这一点.
我的文字字段
<div class="form-group" ng-class="{ 'has-error' : submitted && (thirdPartyForm.beneAcc.$pristine || thirdPartyForm.beneAcc.$invalid )}">
<label class="labelColor"><h5><b>Beneficiary Account/Card Number*</b></h5></label>
<input ng-keyup="validateCreditCard();" onkeypress="return ((event.charCode > 64 && event.charCode < 91) || (event.charCode > 96 && event.charCode < 123) || event.charCode == 8 || event.charCode == 45 || event.charCode == 32 || (event.charCode >= 48 && event.charCode <= 57))" type="{{inputType}}" ng-click="inputClick()" id="beneAcc" name="beneAcc" ng-model="data.beneAcc" class="form-control" ng-blur="validateDesitinationAccount(data.origin, data.beneAcc);" required>
<span class="help-inline" ng-show="submitted && (thirdPartyForm.beneAcc.$pristine || thirdPartyForm.beneAcc.$invalid )">Beneficiary Account No cannot be left blank.</span>
<span …Run Code Online (Sandbox Code Playgroud) html validation angularjs angularjs-directive ionic-framework
I'm trying to include font awesome in my reactjs application and these are the steps i followed.
1. npm install --save font-awesome
2. Import it to my jsx file
import '../../../../../../node_modules/font-awesome/css/font-awesome.min.css';
3. Adding url-loader to my webpack.config.js
{
test: /\.(woff|woff2|eot|ttf)(\?.*$|$)/,
loader: 'url-loader?limit=100000'
}
Run Code Online (Sandbox Code Playgroud)
But i'm getting this issue.How can i fix this?
../~/font-awesome/css/font-awesome.min.css Module parse failed: C:\Users\admin\Documents\revegator-platform\node_modules\font-awesome\css\font-awesome.min.css Unexpected character '@' (4:3) You may need an appropriate loader to handle this file type.
My webpack.config.js
'use strict';
let path = require('path'); …Run Code Online (Sandbox Code Playgroud) 我正在使用代码在滚动时将 div 粘在顶部,并且 div 到达顶部。
该代码工作正常,但导航到另一个页面时出现错误。
TypeError: Cannot read property 'offsetParent' of null
Run Code Online (Sandbox Code Playgroud)
我的代码
render() {
var startProductBarPos = -1;
window.onscroll = function () {
var bar = document.getElementById('nav');
if (startProductBarPos < 0) startProductBarPos = findPosY(bar);
if (window.pageYOffset > startProductBarPos) {
bar.style.position = 'fixed';
bar.style.width = '58.6%'
bar.style.top = 0;
} else {
bar.style.position = 'relative';
bar.style.width = '100%'
}
};
function findPosY(obj) {
var curtop = 0;
if (typeof (obj.offsetParent) != 'undefined' && obj.offsetParent) {
while (obj.offsetParent) {
curtop …Run Code Online (Sandbox Code Playgroud) html ×6
angularjs ×4
android ×3
javascript ×3
css ×2
reactjs ×2
back-button ×1
cordova ×1
font-awesome ×1
google-maps ×1
json ×1
marker ×1
overlay ×1
scroll ×1
urlloader ×1
validation ×1
webpack ×1