所以标题说明了一切.我的内部出现了编译错误onClick.
这是代码.
public class fieldsActivity extends Activity {
Button addSiteButton;
Button cancelButton;
Button signInButton;
/**
* Called when the activity is first created.
*/
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
// to create a custom title bar for activity window
requestWindowFeature(Window.FEATURE_CUSTOM_TITLE);
setContentView(R.layout.fields);
// use custom layout title bar
getWindow().setFeatureInt(Window.FEATURE_CUSTOM_TITLE, R.layout.topbar);
Pager adapter = new Pager();
ViewPager mPager = (ViewPager) findViewById(R.id.fieldspager);
mPager.setAdapter(adapter);
mPager.setCurrentItem(1);
addSiteButton = (Button) findViewById(R.id.addSiteButton);
addSiteButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
mPager.setCurrentItem(2, true); …Run Code Online (Sandbox Code Playgroud) 我的ViewPager中的一个布局有一个按钮."R.layout.add_site".我想选择按下按钮,它会滚动到我的特定页面.我已经可以选择滑动到特定页面,但我想同时拥有这两个页面.
现在我确定有办法做到这一点,但由于某种原因,我无法弄明白.
你会看到我做了一个尝试,但只是不知道要调用什么方法,以使其滚动到所需的页面.这是R.layout.main.
这是我的代码.
public class fieldsActivity extends Activity {
Button addSiteButton;
Button cancelButton;
Button signInButton;
/**
* Called when the activity is first created.
*/
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
// to create a custom title bar for activity window
requestWindowFeature(Window.FEATURE_CUSTOM_TITLE);
setContentView(R.layout.fields);
// use custom layout title bar
getWindow().setFeatureInt(Window.FEATURE_CUSTOM_TITLE, R.layout.topbar);
Pager adapter = new Pager();
ViewPager mPager = (ViewPager) findViewById(R.id.fieldspager);
mPager.setAdapter(adapter);
mPager.setCurrentItem(1);
addSiteButton = (Button) findViewById(R.id.addSiteButton);
addSiteButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
// Don't …Run Code Online (Sandbox Code Playgroud) android android-animation android-layout android-button android-viewpager
我一直在做一些研究,试图弄清楚如何从instagram api中显示超过20个正在进入的图像.我是新手,所以任何帮助将不胜感激!试着看看是否有任何工作?看到一些关于添加可能有帮助的分页的东西..如果那个案例细节如何做到这一点也会很棒!
这是我到目前为止的代码.
<script type="text/javascript">
$.ajax({
type: "GET",
dataType: "jsonp",
cache: false,
url: "https://api.instagram.com/v1/tags/coffee/media/recent?client_id=[]&access_token=[]",
success: function(data) {
for (var i = 0; i < 20; i++) {
$(".instagram").append("<a class='big-square span2' target='_blank' href='" + data.data[i].link +"'><img src='" + data.data[i].images.low_resolution.url +"'></img></a>");
}
}
});
</script>
Run Code Online (Sandbox Code Playgroud) 所以我有一个文件路径,看起来像这样的文件路径.
./CatDV/S1/SFX/steam/6004_90_04 LargeHeadlightSm.wav
./CatDV/S1/SFX/steam/AirHissPressureRe HIT032001.wav
./CatDV/S1/SFX/steam/Impact_Metal_Bullet_Hit(1).wav
./CatDV/S1/SFX/steam/Impact_Metal_Bullet_Hit.wav
./CatDV/S1/SFX/steam/6004_94_02 LargeHeavyGlassS.wav
./CatDV/S1/SFX/steam/Impact_Glass_Smash.wav
./CatDV/S1/SFX/steam/AirReleaseHeavyAi HIT030701.wav
./CatDV/S1/SFX/steam/SDR02_15SCIF RhythmicRever.wav
./CatDV/S1/SFX/steam/VAL02_08CRSH GlassBreaking.wav
./CatDV/S1/SFX/steam/AirReleaseLargeAi HIT030601.wav
./CatDV/S1/SFX/steam/SDR02_14SCIF Rhythmic3Beat.wav
./CatDV/S1/SFX/steam/6004_94_01 LargeGlassSmash.wav
我想将所有这些分成ul li list.so
> CatDV
> S1
> SFX
> steam
> filename.extension
Run Code Online (Sandbox Code Playgroud)
等等...
这是我正在使用的阵列.我用以下功能输出了这个.
array(1) {
[""]=>
array(1) {
["CatDV"]=>
array(1) {
["S1"]=>
array(1) {
["SFX"]=>
array(1) {
["steam"]=>
array(12) {
["6004_90_04 LargeHeadlightSm.wav"]=>
string(52) "./CatDV/S1/SFX/steam/6004_90_04 LargeHeadlightSm.wav"
["AirHissPressureRe HIT032001.wav"]=>
string(52) "./CatDV/S1/SFX/steam/AirHissPressureRe HIT032001.wav"
["Impact_Metal_Bullet_Hit(1).wav"]=>
string(51) "./CatDV/S1/SFX/steam/Impact_Metal_Bullet_Hit(1).wav"
["Impact_Metal_Bullet_Hit.wav"]=>
string(48) "./CatDV/S1/SFX/steam/Impact_Metal_Bullet_Hit.wav"
["6004_94_02 LargeHeavyGlassS.wav"]=>
string(52) "./CatDV/S1/SFX/steam/6004_94_02 LargeHeavyGlassS.wav"
["Impact_Glass_Smash.wav"]=>
string(43) "./CatDV/S1/SFX/steam/Impact_Glass_Smash.wav"
["AirReleaseHeavyAi HIT030701.wav"]=> …Run Code Online (Sandbox Code Playgroud) 所以我正在努力将范围传递给我的自定义指令.
这是我的HTML
<li ng-repeat="post in posts | filter:search | orderBy:sortField:reverse" class="archives-listing" ng-class="{'last-border':$last}">
<archive-notes></archive-notes>
</li>
Run Code Online (Sandbox Code Playgroud)
这是我的指示
app.directive('archiveNotes', function(){
return {
restrict: 'E',
transclude: true,
scope: {
notes: '@',
paths: '@'
},
controller: function($scope) {
},
templateUrl: '/wp-content/themes/twentythirteen/js/angular/templates/notes.html'
}
})
app.directive('archiveFolders', function(){
return {
require: '^archiveNotes',
restrict: 'E',
transclude: true,
scope: {
path: '@'
},
link: function(scope, element, attrs) {
},
templateUrl: '/wp-content/themes/twentythirteen/js/angular/templates/folders.html'
}
});
Run Code Online (Sandbox Code Playgroud)
这是我的模板.
notes.html
<div ng-class="{'found' : find(post.paths[$index], search)}" class="arch-notes">
<div ng-bind-html="is_NotesEmpty(post.notes)">{{post.notes}}</div>
<archive-folders></archive-folders>
</div>
folders.html
<div ng-repeat="path in post.paths …Run Code Online (Sandbox Code Playgroud) javascript angularjs angularjs-directive angularjs-scope angularjs-ng-repeat
android ×2
javascript ×2
angularjs ×1
arrays ×1
html ×1
html-lists ×1
instagram ×1
java ×1
jquery ×1
php ×1