本文整理汇总了Java中android.widget.ViewAnimator.setDisplayedChild方法的典型用法代码示例。如果您正苦于以下问题:Java ViewAnimator.setDisplayedChild方法的具体用法?Java ViewAnimator.setDisplayedChild怎么用?Java ViewAnimator.setDisplayedChild使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类android.widget.ViewAnimator
的用法示例。
在下文中一共展示了ViewAnimator.setDisplayedChild方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: onOptionsItemSelected
import android.widget.ViewAnimator; //导入方法依赖的package包/类
@Override
public boolean onOptionsItemSelected(MenuItem item) {
switch(item.getItemId()) {
case R.id.menu_toggle_log:
mLogShown = !mLogShown;
ViewAnimator output = (ViewAnimator) findViewById(R.id.sample_output);
if (mLogShown) {
output.setDisplayedChild(1);
} else {
output.setDisplayedChild(0);
}
supportInvalidateOptionsMenu();
return true;
}
return super.onOptionsItemSelected(item);
}
示例2: onCreateView
import android.widget.ViewAnimator; //导入方法依赖的package包/类
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
// Inflate the layout for this fragment
View v = inflater.inflate(R.layout.display_options_popup, container);
final ViewAnimator viewAnimator = v.findViewById(R.id.settings_view_container);
viewAnimator.setDisplayedChild(mCurrentView);
Window window = getDialog().getWindow();
if (window != null) {
window.setGravity(Gravity.TOP | Gravity.END);
// window.setDimAmount(0);
window.clearFlags(WindowManager.LayoutParams.FLAG_DIM_BEHIND);
//getActivity().getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN);
//window.setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,WindowManager.LayoutParams.FLAG_FULLSCREEN);
}
return v;
}
示例3: switchView
import android.widget.ViewAnimator; //导入方法依赖的package包/类
@UiThread
void switchView(View parentView, int showView) {
if (parentView == null)
return;
FilesListAdapter.ViewHolder holder = (FilesListAdapter.ViewHolder) parentView.getTag();
ViewAnimator viewAnimator = holder.animator;
viewAnimator.setInAnimation(context, R.anim.slide_down);
int viewIndex = 0;
switch (showView) {
case R.id.dataLayout:
viewIndex = 0;
break;
case R.id.DecryptLayout:
viewIndex = 1;
break;
}
viewAnimator.setDisplayedChild(viewIndex);
holder.page = viewIndex;
}
示例4: buildView
import android.widget.ViewAnimator; //导入方法依赖的package包/类
protected ViewAnimator buildView() {
LayoutInflater li = getLayoutInflater();
ViewAnimator va = (ViewAnimator) li.inflate(R.layout.base, null);
View v = li.inflate(R.layout.main, null);
if (app.isLite()) {
((ImageView) v.findViewById(R.id.logo)).setImageResource(R.drawable.logo_lite);
}
View touch = v.findViewById(R.id.touch_screen);
touch.setOnTouchListener(simpleTouchHandler);
LockSlider ls = (LockSlider) v.findViewById(R.id.drawer);
if (sharedPreferences.getBoolean(MkRemotePreferences.cs(R.string.c_lock_on), false)) {
ls.lock();
} else {
ls.unlock();
}
va.addView(v, MAIN_VIEW);
va.addView(li.inflate(R.layout.keyboard, null), KEYBOARD_VIEW);
va.addView(new View(this), BLANK_VIEW);
va.setDisplayedChild(currentView);
return va;
}
示例5: setDisplayedChild
import android.widget.ViewAnimator; //导入方法依赖的package包/类
@BindingAdapter("displayedChild")
public static void setDisplayedChild(@NonNull final ViewAnimator viewAnimator,
final int child) {
if (viewAnimator.getDisplayedChild() != child) {
viewAnimator.setDisplayedChild(child);
}
}
示例6: show
import android.widget.ViewAnimator; //导入方法依赖的package包/类
@UiThread
public void show(@IdRes int viewId) {
ViewAnimator animator = (ViewAnimator) sceneView.findViewById(animatorId);
View view = sceneView.findViewById(viewId);
if (animator.getDisplayedChild() != animator.indexOfChild(view)) {
animator.setDisplayedChild(animator.indexOfChild(view));
}
}
示例7: switchView
import android.widget.ViewAnimator; //导入方法依赖的package包/类
@UiThread
void switchView(final View parentView, int showView) {
EditText passwordView = (EditText) parentView.findViewById(R.id.open_password);
View renameView = parentView.findViewById(R.id.rename_name);
ViewAnimator viewAnimator = (ViewAnimator) parentView.findViewById(R.id.viewAnimator);
viewAnimator.setInAnimation(context, R.anim.slide_down);
int viewIndex = 0;
switch (showView) {
case R.id.vault_name_layout:
viewIndex = 0;
break;
case R.id.vault_decrypt_layout:
viewIndex = 1;
if (passwordView != null) {
passwordView.requestFocus();
passwordView.setText(""); //Reset password field everytime
}
break;
case R.id.vault_delete_layout:
viewIndex = 2;
break;
case R.id.vault_rename_layout:
viewIndex = 3;
if (renameView != null)
renameView.requestFocus();
break;
}
viewAnimator.setDisplayedChild(viewIndex);
}
示例8: onDataSetChanged
import android.widget.ViewAnimator; //导入方法依赖的package包/类
private void onDataSetChanged() {
View emptyView = findViewById(android.R.id.empty);
TextView emptyDescription = findViewById(R.id.empty_description);
List<ChosenPhoto> chosenPhotos = mChosenPhotosLiveData.getValue();
if (chosenPhotos != null && !chosenPhotos.isEmpty()) {
emptyView.setVisibility(View.GONE);
// We have at least one image, so consider the Gallery source properly setup
setResult(RESULT_OK);
} else {
// No chosen images, show the empty View
emptyView.setVisibility(View.VISIBLE);
ViewAnimator animator = findViewById(R.id.empty_animator);
if (ContextCompat.checkSelfPermission(this, Manifest.permission.READ_EXTERNAL_STORAGE)
== PackageManager.PERMISSION_GRANTED) {
// Permission is granted, we can show the random camera photos image
animator.setDisplayedChild(0);
emptyDescription.setText(R.string.gallery_empty);
setResult(RESULT_OK);
} else {
// We have no images until they enable the permission
setResult(RESULT_CANCELED);
if (ActivityCompat.shouldShowRequestPermissionRationale(this,
Manifest.permission.READ_EXTERNAL_STORAGE)) {
// We should show rationale on why they should enable the storage permission and
// random camera photos
animator.setDisplayedChild(1);
emptyDescription.setText(R.string.gallery_permission_rationale);
} else {
// The user has permanently denied the storage permission. Give them a link to app settings
animator.setDisplayedChild(2);
emptyDescription.setText(R.string.gallery_denied_explanation);
}
}
}
}