本文整理匯總了Java中android.widget.ViewFlipper.setDisplayedChild方法的典型用法代碼示例。如果您正苦於以下問題:Java ViewFlipper.setDisplayedChild方法的具體用法?Java ViewFlipper.setDisplayedChild怎麽用?Java ViewFlipper.setDisplayedChild使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類android.widget.ViewFlipper
的用法示例。
在下文中一共展示了ViewFlipper.setDisplayedChild方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: onViewCreated
import android.widget.ViewFlipper; //導入方法依賴的package包/類
@Override
public void onViewCreated(View view, @Nullable Bundle savedInstanceState) {
super.onViewCreated(view, savedInstanceState);
ViewFlipper mainViewFlipper = view.findViewById(R.id.recent_emoticon_flipper);
List<Emoticon> emoticonList = getEmoticonsList(getArguments().getInt(ARG_CATEGORY_ID, -1));
if (emoticonList.isEmpty()) {
mainViewFlipper.setDisplayedChild(1);
} else {
mainViewFlipper.setDisplayedChild(0);
GridView emoticonGrid = view.findViewById(R.id.emoticon_list_grid);
emoticonGrid.setNumColumns(getResources().getInteger(R.integer.emoticon_recycler_view_span_size));
emoticonGrid.setOnItemClickListener(this);
//Bind the adapter
//noinspection WrongConstant
EmoticonGridAdapter emoticonGridAdapter = new EmoticonGridAdapter(getActivity(),
mEmoticonProvider, emoticonList);
emoticonGrid.setAdapter(emoticonGridAdapter);
}
}
示例2: onCreate
import android.widget.ViewFlipper; //導入方法依賴的package包/類
@Override
public void
onCreate() {
LayoutInflater inflater =
(LayoutInflater)AHF.getActivity().getSystemService(Context.LAYOUT_INFLATER_SERVICE);
view = inflater.inflate(R.layout.classic_main, null);
ChannelLanesPagerAdapter lanesPagerAdapter = new ChannelLanesPagerAdapter();
lanesPager = (ViewPager)view.findViewById(R.id.main_channel_lane_pager);
lanesPager.setAdapter(lanesPagerAdapter);
panesFlipper = (ViewFlipper)view.findViewById(R.id.main_flipper);
panesFlipper.setDisplayedChild(1);
updateMainTitle();
installListeners();
updateVolume();
ChannelsPane cp = new ChannelsPane();
cp.setTitle("Channel Lane 1");
addChannelsPane(cp);
addChannelsPane(new ChannelsPane("Channel Lane 2"));
setSelectedChannelsPane(cp);
}
示例3: flipToChild
import android.widget.ViewFlipper; //導入方法依賴的package包/類
public static void flipToChild(Activity activity,int flipperID,int child,boolean animate) {
ViewFlipper flipper=(ViewFlipper)activity.findViewById(flipperID);
Animation in=null;
Animation out=null;
if (!animate) {
in=flipper.getInAnimation();
out=flipper.getOutAnimation();
flipper.setInAnimation(null);
flipper.setOutAnimation(null);
}
flipper.getChildAt(child).setVisibility(View.VISIBLE);
flipper.setDisplayedChild(child);
if (!animate) {
flipper.setInAnimation(in);
flipper.setOutAnimation(out);
}
}
示例4: reset
import android.widget.ViewFlipper; //導入方法依賴的package包/類
public void reset() {
player.setHealth(100);
enemy.reset();
ViewFlipper vf = (ViewFlipper) findViewById(R.id.lobby);
vf.setDisplayedChild(0);
enemy = enemies.get(0);
mProgress2 = (ProgressBar) findViewById(R.id.enemy_health);
mProgress2.setMax(enemy.getHealth());
int resourceID = this.getResources().getIdentifier(enemy.getSrc(), "drawable", this.getPackageName());
ImageView enemypic = (ImageView) findViewById(R.id.caravatar);
enemypic.setImageResource(resourceID);
int resourceBID = this.getResources().getIdentifier(enemy.getBack(), "drawable", this.getPackageName());
ImageView backimg = (ImageView) findViewById(R.id.background);
backimg.setImageResource(resourceBID);
mProgress = (ProgressBar) findViewById(R.id.progressBar);
mProgress.setProgress(player.getHealth());
resetFloor();
update();
floorNum = 0;
nextFloor();
}
示例5: showSearch
import android.widget.ViewFlipper; //導入方法依賴的package包/類
@SuppressLint("NewApi")
public void showSearch() {
ViewFlipper viewFlipper = (ViewFlipper) findViewById(R.id.uv_view_flipper);
viewFlipper.setDisplayedChild(1);
if (hasActionBar()) {
if (originalNavigationMode == -1)
originalNavigationMode = getActionBar().getNavigationMode();
getActionBar().setNavigationMode(ActionBar.NAVIGATION_MODE_TABS);
}
}
示例6: hideSearch
import android.widget.ViewFlipper; //導入方法依賴的package包/類
@SuppressLint("NewApi")
public void hideSearch() {
ViewFlipper viewFlipper = (ViewFlipper) findViewById(R.id.uv_view_flipper);
viewFlipper.setDisplayedChild(0);
if (hasActionBar()) {
getActionBar().setNavigationMode(originalNavigationMode == -1 ? ActionBar.NAVIGATION_MODE_STANDARD : originalNavigationMode);
}
}
示例7: addLogItem
import android.widget.ViewFlipper; //導入方法依賴的package包/類
public void addLogItem(String message, int direction){
if(isConfiguring) direction = Direction.Center;
View logView = LayoutInflater.from(this).inflate(R.layout.view_logitem, llLog, false);
ViewFlipper vF = (ViewFlipper) logView.findViewById(R.id.vF);
TextView tvTime = null, tvText = null;
vF.setDisplayedChild(direction);
if(direction == Direction.Out){
tvTime = (TextView) logView.findViewById(R.id.tvTimeR);
tvText = (TextView) logView.findViewById(R.id.tvTextR);
} else if(direction == Direction.In){
tvTime = (TextView) logView.findViewById(R.id.tvTimeL);
tvText = (TextView) logView.findViewById(R.id.tvTextL);
} else if(direction == Direction.Center || direction == Direction.Error){
tvTime = (TextView) logView.findViewById(R.id.tvTimeC);
tvText = (TextView) logView.findViewById(R.id.tvTextC);
tvText.setTextColor(Color.parseColor("#111111"));
}
if(direction == Direction.Error){
tvText.setTextColor(Color.parseColor("#A10000"));
}
Calendar ci = Calendar.getInstance();
tvTime.setText(String.format("%02d", ci.get(Calendar.HOUR)) + ":" + String.format("%02d", ci.get(Calendar.MINUTE)) + ":" + String.format("%02d", ci.get(Calendar.SECOND)));
tvText.setText(message);
llLog.addView(logView,0);
logView.setAlpha(0);
logView.animate().setDuration(400).alpha(1).start();
}
示例8: showOverlay
import android.widget.ViewFlipper; //導入方法依賴的package包/類
public void showOverlay(OverlayController controller, View overlay) {
if(m_overlayController != null) {
evictOverlay();
}
ViewFlipper flipper = (ViewFlipper) findViewById(R.id.overlay_flipper);
flipper.addView(overlay);
flipper.setDisplayedChild(1);
m_overlayController = controller;
setUiFlags();
}
示例9: hideOverlay
import android.widget.ViewFlipper; //導入方法依賴的package包/類
public void hideOverlay(OverlayController controller) {
if(m_overlayController == controller) {
ViewFlipper flipper = (ViewFlipper) findViewById(R.id.overlay_flipper);
flipper.setDisplayedChild(0);
flipper.removeViewAt(1);
m_overlayController = null;
setUiFlags();
}
}
示例10: showSearch
import android.widget.ViewFlipper; //導入方法依賴的package包/類
public void showSearch() {
ViewFlipper viewFlipper = (ViewFlipper) findViewById(R.id.uv_view_flipper);
viewFlipper.setDisplayedChild(1);
if (hasActionBar()) {
if (originalNavigationMode == -1)
originalNavigationMode = actionBar.getNavigationMode();
actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_TABS);
}
}
示例11: hideSearch
import android.widget.ViewFlipper; //導入方法依賴的package包/類
public void hideSearch() {
ViewFlipper viewFlipper = (ViewFlipper) findViewById(R.id.uv_view_flipper);
viewFlipper.setDisplayedChild(0);
if (hasActionBar()) {
actionBar.setNavigationMode(originalNavigationMode == -1 ? ActionBar.NAVIGATION_MODE_STANDARD : originalNavigationMode);
}
}
示例12: changeLibraryView
import android.widget.ViewFlipper; //導入方法依賴的package包/類
void changeLibraryView(final int view) {
final ViewFlipper vf = getViewflipper();
if (view == VIEW_LIBRARY) {
vf.setDisplayedChild(VIEW_LIBRARY);
} else {
vf.setDisplayedChild(VIEW_RECENT);
}
}
示例13: onCreate
import android.widget.ViewFlipper; //導入方法依賴的package包/類
@TargetApi(23)
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
if (!Environment.MEDIA_MOUNTED
.equals(Environment.getExternalStorageState())) {
Toast
.makeText(this, "Cannot access external storage!",
Toast.LENGTH_LONG)
.show();
finish();
}
previewFrame=
new File(getExternalCacheDir(), "cam2-preview.jpg");
setContentView(R.layout.main);
utils=new RuntimePermissionUtils(this);
wizardBody=(ViewFlipper)findViewById(R.id.wizard_body);
previous=(Button)findViewById(R.id.previous);
next=(Button)findViewById(R.id.next);
if (savedInstanceState==null) {
String filename="cam2_"+Build.MANUFACTURER+"_"+Build.PRODUCT
+"_"+new SimpleDateFormat("yyyyMMdd'-'HHmmss").format(new Date());
filename=filename.replaceAll(" ", "_");
testRoot=new File(getExternalFilesDir(null), filename);
}
else {
wizardBody.setDisplayedChild(savedInstanceState.getInt(STATE_PAGE, 0));
testRoot=new File(savedInstanceState.getString(STATE_TEST_ROOT));
isVideo=savedInstanceState.getBoolean(STATE_IS_VIDEO, false);
}
testZip=new File(testRoot.getAbsolutePath()+".zip");
if (!haveNecessaryPermissions() && utils.useRuntimePermissions()) {
requestPermissions(PERMS_ALL, RESULT_PERMS_ALL);
}
else {
handlePage();
}
}
示例14: onViewCreated
import android.widget.ViewFlipper; //導入方法依賴的package包/類
@Override
public void onViewCreated(View view, Bundle savedInstanceState) {
super.onViewCreated(view, savedInstanceState);
ViewFlipper modeSelector = (ViewFlipper) view.findViewById(R.id.modeSelector);
// Folder init
if(getArguments().getBoolean(FileManagerIntents.EXTRA_DIRECTORIES_ONLY)){
modeSelector.setDisplayedChild(0);
Button button = (Button) view.findViewById(R.id.button);
button.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
pickFileOrFolder(new File(getPath()), false);
}
});
if(getArguments().containsKey(FileManagerIntents.EXTRA_BUTTON_TEXT)){
button.setText(getArguments().getString(FileManagerIntents.EXTRA_BUTTON_TEXT));
}
}
// Files init
else {
modeSelector.setDisplayedChild(1);
mPickBar = (PickBar) view.findViewById(R.id.pickBar);
mPickBar.setButtonText(getArguments().getString(FileManagerIntents.EXTRA_BUTTON_TEXT));
mPickBar.setText(getFilename());
// TODO make file visible, i.e. scroll to item
mPickBar.setOnPickRequestedListener(new OnPickRequestedListener() {
@Override
public void pickRequested(String filename) {
if(filename.trim().length() == 0) {
Toast.makeText(getActivity(), R.string.choose_filename, Toast.LENGTH_SHORT).show();
return;
}
// Pick
pickFileOrFolder(new File(getPath() + (getPath().endsWith("/") ? "" : "/") + filename),
getArguments().getBoolean(FileManagerIntents.EXTRA_IS_GET_CONTENT_INITIATED, false));
}
});
}
}
示例15: manageUi
import android.widget.ViewFlipper; //導入方法依賴的package包/類
public void manageUi() {
Button superbutton = (Button) findViewById(R.id.superButton);
HorizontalScrollView scrolltext = (HorizontalScrollView) findViewById(R.id.scroll_text);
EditText quicksearch = (EditText) findViewById(R.id.search_box);
ViewFlipper topflipper = (ViewFlipper) findViewById(R.id.flipper_top);
findViewById(R.id.bottomFlipper);
// HorizontalScrollView scrollButtons =
// (HorizontalScrollView)findViewById(R.id.scroll_buttons);
HorizontalScrollView multiscrollButtons = (HorizontalScrollView) findViewById(R.id.multi_scroll_buttons);
if (searchflag == true) {
multiselectflag = false;
superbutton.setText("Back");
quicksearch.requestFocus();
topflipper.setAnimation(launchAnimation(R.anim.fade));
topflipper.setDisplayedChild(topflipper.indexOfChild(quicksearch));
} else if (searchflag == false) {
quicksearch.setText("");
superbutton.setText("Search");
topflipper.setAnimation(launchAnimation(R.anim.appear));
topflipper.setDisplayedChild(topflipper.indexOfChild(scrolltext));
if (multiselectflag == true) {
// scrollButtons.setVisibility(View.GONE);
multiscrollButtons.setVisibility(View.VISIBLE);
// bottomflipper.setAnimation(launchAnimation(R.anim.appear));
// bottomflipper.setDisplayedChild(bottomflipper.indexOfChild(multiscrollButtons));
if (unselectflag == true) {
superbutton.setText("Unselect");
} else {
superbutton.setText("Select all");
}
} else if (multiselectflag == false) {
// bottomflipper.setAnimation(launchAnimation(R.anim.disappear));
// bottomflipper.setDisplayedChild(bottomflipper.indexOfChild(scrollButtons));
// scrollButtons.setVisibility(View.VISIBLE);
multiscrollButtons.setVisibility(View.GONE);
}
}
}