@TargetApi(Build.VERSION_CODES.HONEYCOMB) @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); that = this; final ActionBar actionBar = getActionBar(); actionBar.setCustomView(R.layout.actionbar_profiler_audio); actionBar.setDisplayShowTitleEnabled(true); actionBar.setDisplayShowCustomEnabled(true); actionBar.setDisplayHomeAsUpEnabled(true); actionBar.setBackgroundDrawable(getResources().getDrawable(R.color.black)); if (savedInstanceState == null) { Bundle extras = getIntent().getExtras(); imageUrl = extras.getString("image_url"); profileName = extras.getString("profile_name"); identityProfileId = extras.getString("identity_profile_id"); firstName = extras.getString("first_name"); lastName = extras.getString("last_name"); userIdentityProfileId = extras.getString("user_identity_profile_id"); useDefault = extras.getBoolean("use_default"); } Bundle extras = getIntent().getExtras(); audioFileName = extras.getStringArray("audio_file_name"); fileName = extras.getStringArray("file_name"); fileLocation = extras.getStringArray("file_location"); audioDescription = extras.getStringArray("audio_description"); setListAdapter(new ProfilerAudioAdapter(this, audioFileName, fileName, audioDescription)); }
private void setupActionBar() { ActionBar bar = getActionBar(); bar.setCustomView(R.layout.view_custom_actionbar); bar.setDisplayShowCustomEnabled(true); bar.setDisplayHomeAsUpEnabled(true); bar.setHomeButtonEnabled(true); }
/** 初始化ActionBar */ private void initActionBar() { ActionBar actionBar = getActionBar(); if (actionBar != null) { actionBar.setDisplayShowCustomEnabled(true); actionBar.setCustomView(R.layout.actionbar_title); } }
protected void init() { setContentView(R.layout.wallpaper_cropper); mCropView = (CropView) findViewById(R.id.cropView); Intent cropIntent = getIntent(); final Uri imageUri = cropIntent.getData(); if (imageUri == null) { Log.e(LOGTAG, "No URI passed in intent, exiting WallpaperCropActivity"); finish(); return; } int rotation = getRotationFromExif(this, imageUri); mCropView.setTileSource(new BitmapRegionTileSource(this, imageUri, 1024, rotation), null); mCropView.setTouchEnabled(true); // Action bar // Show the custom action bar view final ActionBar actionBar = getActionBar(); actionBar.setCustomView(R.layout.actionbar_set_wallpaper); actionBar .getCustomView() .setOnClickListener( new View.OnClickListener() { @Override public void onClick(View v) { boolean finishActivityWhenDone = true; cropImageAndSetWallpaper(imageUri, null, finishActivityWhenDone); } }); }
private void customizeActionbar() { mActionBar = getActionBar(); if (mActionBar != null) { mActionBarView = (FrameLayout) getLayoutInflater().inflate(R.layout.base_actionbar_view, null); mActionBarView .findViewById(R.id.ic_back) .setOnClickListener( new View.OnClickListener() { @Override public void onClick(View arg0) { onBackPressed(); } }); TextView title = (TextView) mActionBarView.findViewById(R.id.ab_title); title.setText("基本设置"); mActionBar.setCustomView( mActionBarView, new ActionBar.LayoutParams( ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT)); mActionBar.setDisplayShowCustomEnabled(true); mActionBar.setDisplayShowHomeEnabled(false); mActionBar.setDisplayShowTitleEnabled(false); } }
private void setupActionBar() { ActionBar actionBar = getActionBar(); actionBar.setDisplayShowCustomEnabled(true); actionBar.setDisplayShowTitleEnabled(false); actionBar.setHomeButtonEnabled(false); actionBar.setDisplayHomeAsUpEnabled(false); LayoutInflater inflator = (LayoutInflater) getSystemService(Context.LAYOUT_INFLATER_SERVICE); View actionBarCustomView = inflator.inflate(R.layout.white_action_bar, null); actionBarCustomView.findViewById(R.id.home_icon_container).setVisibility(View.VISIBLE); actionBar.setCustomView(actionBarCustomView); SpannableString s = new SpannableString(getString(R.string.redeem)); s.setSpan( new TypefaceSpan( getApplicationContext(), CommonLib.BOLD_FONT_FILENAME, getResources().getColor(R.color.white), getResources().getDimension(R.dimen.size16)), 0, s.length(), Spannable.SPAN_EXCLUSIVE_EXCLUSIVE); TextView title = (TextView) actionBarCustomView.findViewById(R.id.title); ((RelativeLayout.LayoutParams) actionBarCustomView.findViewById(R.id.back_icon).getLayoutParams()) .setMargins(width / 40, 0, 0, 0); actionBarCustomView.findViewById(R.id.title).setPadding(width / 20, 0, width / 40, 0); title.setText(s); }
public void onPrepareOptionsMenu(Menu menu) { super.onPrepareOptionsMenu( menu); // REMOVE THE THREE DOT ICON FROM THE ACTIONBAR, SINCE IT IS NOT NEEDED FOR NOW MenuItem item = menu.findItem(R.id.action_settings); item.setVisible(false); // INFLATE CUSTOM ACTIONBAR ActionBar ab = getActivity().getActionBar(); ab.setDisplayShowTitleEnabled(false); ab.setDisplayShowCustomEnabled(true); ab.setDisplayShowHomeEnabled(false); View customActionView = getActivity().getLayoutInflater().inflate(R.layout.actionbar_custom_layout, null); ab.setCustomView(customActionView); // ADD A LISTENER TO THE VIEWS IN THE CUSTOM ACTION BAR LAYOUT acbar_cancel_button = (LinearLayout) customActionView.findViewById(R.id.custom_ab_cancel); acbar_save_button = (LinearLayout) customActionView.findViewById(R.id.custom_ab_done); acbar_cancel_button.setOnClickListener( new View.OnClickListener() { @Override public void onClick(View view) { getActivity().onBackPressed(); } }); acbar_save_button.setOnClickListener(new SaveTaskListener()); }
@Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); addPreferencesFromResource(R.xml.settings_special_list); Bundle b = getArguments(); if (b != null) { Log.d(TAG, "id= " + getArguments().getInt("id")); final SpecialList specialList = SpecialList.getSpecialList(getArguments().getInt("id") * -1); ((SpecialListsSettingsActivity) getActivity()).setSpecialList(specialList); ActionBar actionbar = getActivity().getActionBar(); if (specialList == null) actionbar.setTitle("No list"); else actionbar.setTitle(specialList.getName()); if (!MirakelCommonPreferences.isTablet()) { ImageButton delList = new ImageButton(getActivity()); delList.setBackgroundResource(android.R.drawable.ic_menu_delete); actionbar.setDisplayOptions(ActionBar.DISPLAY_SHOW_CUSTOM, ActionBar.DISPLAY_SHOW_CUSTOM); actionbar.setCustomView( delList, new ActionBar.LayoutParams( LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT, Gravity.CENTER_VERTICAL | DefinitionsHelper.GRAVITY_RIGHT)); delList.setOnClickListener(((ListSettings) getActivity()).getDelOnClickListener()); } try { new SpecialListSettings(this, specialList).setup(); } catch (NoSuchListException e) { getActivity().finish(); } } else { Log.d(TAG, "bundle null"); } }
private void initActionBar() { bar.setTitle("Login"); bar.setDisplayShowHomeEnabled(false); bar.setDisplayShowTitleEnabled(false); LayoutInflater mInflater = (LayoutInflater) getSystemService(Context.LAYOUT_INFLATER_SERVICE); View mCustomView = mInflater.inflate(R.layout.custom_action_bar, null); ActionBar.LayoutParams params = new ActionBar.LayoutParams( ActionBar.LayoutParams.MATCH_PARENT, ActionBar.LayoutParams.MATCH_PARENT); mCustomView.setLayoutParams(params); bar.setCustomView(mCustomView); actionBarText = (TextView) mCustomView.findViewById(R.id.nameOfScreen); actionBarText.setText("Login"); back = (Button) mCustomView.findViewById(R.id.back); // back.setVisibility(View.INVISIBLE); back.setOnClickListener( new View.OnClickListener() { @Override public void onClick(View v) { /*Log.e("DEMO", "clicked"); //removeCurrentFragment(); actionBarText.setText("Login"); //isSignUpEnabled = false; back.setVisibility(View.INVISIBLE); */ } }); bar.setDisplayShowCustomEnabled(true); }
@Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); overridePendingTransition(R.anim.fadein, R.anim.fadeout); // .................................... // Load state of filter from Bundle if (savedInstanceState != null) { mSeriesFilter = savedInstanceState.getString("mSeriesFilter"); mFilterMode = savedInstanceState.getInt("mFilterMode"); if (mSeriesFilter == null) mSeriesFilter = ""; // if no filter found } else { // if no state, load in default pref. SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(this); String tmp = prefs.getString("libraryFilter", "0"); this.mFilterMode = Integer.parseInt(tmp); } // if // .................................... mThumbPath = Environment.getExternalStorageDirectory().getAbsolutePath() + "/OpenComicReader/thumbs/"; mSpinAdapter = new ArrayAdapter<String>( this, android.R.layout.simple_spinner_dropdown_item, this.getResources().getStringArray(R.array.libraryFilter)); // .................................... // Setup Actionbar ActionBar mActionBar = this.getActionBar(); mActionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_LIST); mActionBar.setDisplayShowTitleEnabled(false); mActionBar.setListNavigationCallbacks(mSpinAdapter, this); mActionBar.setSelectedNavigationItem(mFilterMode); mActionBar.setDisplayOptions( ActionBar.DISPLAY_SHOW_CUSTOM | ActionBar.DISPLAY_USE_LOGO | ActionBar.DISPLAY_SHOW_HOME); mActionBar.setCustomView(R.layout.activity_main_actionbar); mCountLbl = (TextView) mActionBar.getCustomView().findViewById(R.id.lblCount); mSeriesLbl = (TextView) mActionBar.getCustomView().findViewById(R.id.lblSeries); // .................................... // Setup Main View Area mAdapter = new SqlCursorAdapter(this); mAdapter.setItemLayout(R.layout.listitem_main); mGridView = (GridView) findViewById(R.id.lvMain); mGridView.setAdapter(mAdapter); mGridView.setOnItemClickListener(this); registerForContextMenu(mGridView); // Route event from Activity to View // .................................... // Start DB and Data Loader mDb = new Sqlite(this); mDb.openRead(); getSupportLoaderManager().initLoader(0, null, this); } // func
/** configure the action bar */ private void configureActionBar() { ActionBar actionBar = getActionBar(); actionBar.setDisplayShowHomeEnabled(true); actionBar.setDisplayShowCustomEnabled(true); View actionBarNumberView = getLayoutInflater().inflate(R.layout.title_bar_number, null); actionBar.setCustomView(actionBarNumberView, new LayoutParams(Gravity.END)); mNumberTextView = (TextView) actionBarNumberView.findViewById(R.id.number); }
public void initActionBar() { ActionBar actionBar = getActionBar(); actionBar.setDisplayShowCustomEnabled(true); actionBar.setCustomView(R.layout.actionbar_main); actionBar.setDisplayUseLogoEnabled(false); actionBar.setDisplayShowHomeEnabled(false); View view = actionBar.getCustomView(); RelativeLayout exitBt = (RelativeLayout) view.findViewById(R.id.add_lay); }
@Override public void setCustomView(View view, LayoutParams layoutParams) { android.app.ActionBar.LayoutParams lp = new android.app.ActionBar.LayoutParams(layoutParams); lp.gravity = layoutParams.gravity; lp.bottomMargin = layoutParams.bottomMargin; lp.topMargin = layoutParams.topMargin; lp.leftMargin = layoutParams.leftMargin; lp.rightMargin = layoutParams.rightMargin; mActionBar.setCustomView(view, lp); }
@Override public void onCreate(Bundle savedInstanceState) { // TODO Auto-generated method stub super.onCreate(savedInstanceState); ActionBar actionBar = getActivity().getActionBar(); LayoutInflater mInflater = LayoutInflater.from(getActivity()); View mCustomView = mInflater.inflate(R.layout.custom_action_bar, null); TextView textTile = (TextView) mCustomView.findViewById(R.id.textTitle); imageIcon = (ImageView) mCustomView.findViewById(R.id.imageIcon); imageIcon.setVisibility(View.GONE); btnBack = (ImageView) mCustomView.findViewById(R.id.btnBack); btnGallery = (ImageView) mCustomView.findViewById(R.id.picture_icon); textTile.setText("Bali"); actionBar.setCustomView(mCustomView); btnGallery.setVisibility(View.VISIBLE); btnBack.setOnClickListener( new View.OnClickListener() { @Override public void onClick(View v) { // TODO Auto-generated method stub // onBackPressed(); listener.onItemAttractionListMapPage(R.id.btnBack); } }); btnGallery.setOnClickListener( new View.OnClickListener() { @Override public void onClick(View v) { // TODO Auto-generated method stub if (maps) { btnGallery.setImageResource(R.drawable.pin_icon); maps = false; listView.setVisibility(View.VISIBLE); layoutMap.setVisibility(View.GONE); arcMenu.setVisibility(View.VISIBLE); } else { btnGallery.setImageResource(R.drawable.picture_icon); maps = true; listView.setVisibility(View.GONE); layoutMap.setVisibility(View.VISIBLE); arcMenu.setVisibility(View.GONE); } } }); // actionBar.setBackgroundDrawable(new ColorDrawable(0x0065b3)); actionBar.setDisplayShowTitleEnabled(false); actionBar.setDisplayShowCustomEnabled(true); actionBar.setDisplayUseLogoEnabled(false); actionBar.setDisplayShowHomeEnabled(false); }
public static void setActionBarLayout(ActionBar actionBar, Context context, int layoutId) { if (null != actionBar) { actionBar.setDisplayShowHomeEnabled(false); actionBar.setDisplayShowCustomEnabled(true); actionBar.setDisplayShowTitleEnabled(false); LayoutInflater inflator = LayoutInflater.from(context); View v = inflator.inflate(layoutId, null); ActionBar.LayoutParams layout = new ActionBar.LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT); actionBar.setCustomView(v, layout); } }
private void initActionBar() { actionBar = getActionBar(); actionBar.setDisplayHomeAsUpEnabled(true); actionBar.setDisplayShowHomeEnabled(true); actionBar.setHomeButtonEnabled(true); actionBar.setDisplayShowTitleEnabled(false); actionBar.setDisplayShowCustomEnabled(true); View view = View.inflate(this, R.layout.actionbar_title, null); mActionBarTitle = (ShimmerTextView) view.findViewById(R.id.tv_shimmer); new Shimmer().start(mActionBarTitle); actionBar.setCustomView(view); }
private void setupActionBar() { ActionBar actionBar = getActionBar(); if (actionBar != null) { actionBar.setDisplayOptions( ActionBar.DISPLAY_HOME_AS_UP | ActionBar.DISPLAY_SHOW_TITLE | ActionBar.DISPLAY_SHOW_CUSTOM, ActionBar.DISPLAY_HOME_AS_UP | ActionBar.DISPLAY_SHOW_TITLE | ActionBar.DISPLAY_SHOW_CUSTOM); actionBar.setTitle(""); actionBar.setCustomView(R.layout.conversation_list_multi_actionbar); mActionButton = (Button) findViewById(R.id.multi_action_done); if (mManageMode == MessageUtils.FORWARD_MODE) { mActionButton.setText(R.string.menu_forward); } else if (mManageMode == MessageUtils.SIM_MESSAGE_MODE) { mActionButton.setText(R.string.done_delete); } else if (mManageMode == MessageUtils.BATCH_DELETE_MODE) { mActionButton.setText(R.string.menu_batch_delete); } mActionButton.setEnabled(false); mActionButton.setOnClickListener( new View.OnClickListener() { @Override public void onClick(View v) { confirmMultiAction(); } }); Button mSelectionMenuButton = (Button) findViewById(R.id.select_menu); mSelectionMenu = new SelectionMenu( this, mSelectionMenuButton, new PopupList.OnPopupItemClickListener() { @Override public boolean onPopupItemClick(int itemId) { if (itemId == SelectionMenu.SELECT_OR_DESELECT) { if (mHasSelectAll) { clearSelect(); mHasSelectAll = false; } else { allSelect(); mHasSelectAll = true; } mSelectionMenu.updateSelectAllMode(mHasSelectAll); } return true; } }); mSelectionMenu.setTitle(getString(R.string.selected_count, 0)); } }
/** * Override this callback to initialize the {@link ActionBar} associated with this {@link * Activity}. * * @param actionBar the {@link ActionBar} intance to be initialized * @since 1.1.0 */ protected void onInitActionBar(ActionBar actionBar) { if (actionBar != null) { View header = getLayoutInflater().inflate(R.layout.action_view_title, null); ((TextView) header.findViewById(R.id.title)).setText(onInitTitle()); ((TextView) header.findViewById(R.id.subtitle)).setText(onInitSubtitle()); actionBar.setDisplayShowTitleEnabled(false); actionBar.setDisplayShowCustomEnabled(true); actionBar.setCustomView(header); } }
private static View initView(ActionBar actionBar, int viewId, OnClickListener onDone) { // Inflate a custom view and set a Done handler actionBar.setCustomView(viewId); View view = actionBar.getCustomView(); view.findViewById(R.id.actionbar_done).setOnClickListener(onDone); // Show the custom action bar view and hide the normal Home icon and title. actionBar.setDisplayShowTitleEnabled(false); actionBar.setDisplayShowHomeEnabled(false); actionBar.setDisplayShowCustomEnabled(true); return view; }
@SuppressWarnings("unchecked") protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_link); // Set up layout bridgesList = (ListView) findViewById(R.id.link_bridges); bridgesAdapter = new BridgeAdapter(this); bridgesList.setAdapter(bridgesAdapter); bridgesList.setEmptyView(findViewById(R.id.link_empty)); // Set up loading UI elements ActionBar ab = getActionBar(); ab.setCustomView(R.layout.loader); ab.setDisplayShowCustomEnabled(true); ab.setDisplayShowHomeEnabled(false); RelativeLayout loadingLayout = (RelativeLayout) ab.getCustomView(); loadingSpinner = (ProgressBar) loadingLayout.findViewById(R.id.loader_spinner); refreshButton = (ImageButton) loadingLayout.findViewById(R.id.loader_refresh); setEventHandlers(); // Restore state or start over if (savedInstanceState == null) { Bridge lastBridge = Util.getLastBridge(this); if (lastBridge != null) { // This will be set again after a successful connection, connection failure leaves the last // bridge null Util.setLastBridge(this, null); // Try connecting to last bridge connectToLastBridge(lastBridge); } else { // Start searching for bridges and add them to the results startSearching(true); } } else { bridges = (ArrayList<Bridge>) savedInstanceState.getSerializable("bridges"); for (Bridge b : bridges) { bridgesAdapter.add(b); } // If a search was running, continue without removing existing results if (savedInstanceState.getBoolean("searching")) { startSearching(false); } } }
protected void init() { setContentView(R.layout.wallpaper_cropper); mCropView = (CropView) findViewById(R.id.cropView); Intent cropIntent = getIntent(); final Uri imageUri = cropIntent.getData(); if (imageUri == null) { Log.e(LOGTAG, "No URI passed in intent, exiting WallpaperCropActivity"); finish(); return; } // Action bar // Show the custom action bar view final ActionBar actionBar = getActionBar(); actionBar.setCustomView(R.layout.actionbar_set_wallpaper); actionBar .getCustomView() .setOnClickListener( new View.OnClickListener() { @Override public void onClick(View v) { boolean finishActivityWhenDone = true; cropImageAndSetWallpaper(imageUri, null, finishActivityWhenDone); } }); mSetWallpaperButton = findViewById(R.id.set_wallpaper_button); // Load image in background final BitmapRegionTileSource.UriBitmapSource bitmapSource = new BitmapRegionTileSource.UriBitmapSource(this, imageUri, 1024); mSetWallpaperButton.setEnabled(false); Runnable onLoad = new Runnable() { public void run() { if (bitmapSource.getLoadingState() != BitmapSource.State.LOADED) { Toast.makeText( WallpaperCropActivity.this, getString(R.string.wallpaper_load_fail), Toast.LENGTH_LONG) .show(); finish(); } else { mSetWallpaperButton.setEnabled(true); } } }; setCropViewTileSource(bitmapSource, true, false, onLoad); }
/** * Sets custom view on ActionBar for Done/Cancel activities * * @param actionBar * @param onDone * @param onCancel */ public static void setDoneCancelView( ActionBar actionBar, OnClickListener onDone, OnClickListener onCancel) { View view = initView(actionBar, R.layout.actionbar_custom_view_done_cancel, onDone); // Set a Cancel handler view.findViewById(R.id.actionbar_cancel).setOnClickListener(onCancel); // Set the view again, this time with custom layout parameters actionBar.setCustomView( view, new ActionBar.LayoutParams( ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT)); }
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); // this.requestWindowFeature(Window.FEATURE_NO_TITLE); // set action bar stuff ActionBar ab = getActionBar(); ab.setDisplayOptions(ActionBar.DISPLAY_SHOW_CUSTOM); ab.setCustomView(R.layout.actionbar); // receive info Intent intent = getIntent(); String fromAddress = intent.getStringExtra(SafewalkApplication.EXTRA_FROM); String toAddress = intent.getStringExtra(SafewalkApplication.EXTRA_TO); setContentView(R.layout.safewalk_map); // init javascript interface class mapJS = new MapJS(getApplication().getApplicationContext()); mapJS.setFromAddress(fromAddress); mapJS.setToAddress(toAddress); // link android elements wv = (WebView) findViewById(R.id.wv_map); wv.getSettings().setJavaScriptEnabled(true); wv.setWebChromeClient(new WebChromeClient()); wv.addJavascriptInterface(mapJS, "Safewalk"); wv.getSettings().setRenderPriority(RenderPriority.HIGH); wv.getSettings().setCacheMode(WebSettings.LOAD_NO_CACHE); wv.getSettings().setAllowFileAccess(true); wv.setBackgroundColor( 0x00000000); // must set background to zero for background to show through. wv.setLayerType( View.LAYER_TYPE_SOFTWARE, null); // solves a flickering issue of webview content. wv.loadUrl("file:///android_asset/index.html"); this.getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_ALWAYS_HIDDEN); // get relative layout llRoutes = (LinearLayout) findViewById(R.id.ll_routes); // TextView testFrom = (TextView) findViewById(R.id.test_from); // TextView testTo = (TextView) findViewById(R.id.test_to); // testFrom.setText(fromAddress); // testTo.setText(toAddress); }
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.detailed_info); telephone = "10086"; dpview = (TextView) findViewById(R.id.Description); dpview.setText("������ʾ��Ҫ��Ϣ..."); call = (Button) findViewById(R.id.Call); join = (Button) findViewById(R.id.Join); // return_back = (TextView) findViewById(R.id.Return); open_close = (TextView) findViewById(R.id.OpenOrClose); open_close.setText("�鿴���� ��"); call.setOnClickListener(this); join.setOnClickListener(this); // return_back.setOnClickListener(this); open_close.setOnClickListener(this); // �Զ���ActionBar final ActionBar actionBar = getActionBar(); actionBar.setDisplayOptions(ActionBar.DISPLAY_SHOW_CUSTOM); actionBar.setCustomView(R.layout.actionbar_detail_info); // �Զ���ActionBar���� // ָ��״̬����ɫ if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) { setTranslucentStatus(true); } SystemBarTintManager tintManager = new SystemBarTintManager(this); tintManager.setStatusBarTintEnabled(true); tintManager.setStatusBarTintResource(R.color.blueviolet); mTVBack = (Button) findViewById(R.id.detailInfo_backBtn); mTVBack.setOnClickListener(this); itemList = new ArrayList<ParticipatorItem>(); itemList.add(new ParticipatorItem(R.drawable.ghost, "����", "�����ܼ�")); itemList.add(new ParticipatorItem(R.drawable.ghost, "����", "�����ܼ�")); itemList.add(new ParticipatorItem(R.drawable.ghost, "����", "�����ܼ�")); itemList.add(new ParticipatorItem(R.drawable.ghost, "����", "�����ܼ�")); itemList.add(new ParticipatorItem(R.drawable.ghost, "����", "�����ܼ�")); adapter = new Adapter(this, R.layout.participator_item, itemList); lv = (ListView) findViewById(R.id.participatorListView); lv.setAdapter(adapter); lv.setOnItemClickListener(this); }
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_map); ActionBar actionBar = getActionBar(); if (actionBar != null) { actionBar.setDisplayOptions(ActionBar.DISPLAY_SHOW_CUSTOM); View cView = getLayoutInflater().inflate(R.layout.main_bar, null); actionBar.setCustomView(cView); } MapFragment mapFragment = (MapFragment) getFragmentManager().findFragmentById(R.id.map); mapFragment.getMapAsync(this); centered = false; }
public custom_action_bar(final worker ctx, final ActionBar ab) { this.ctx = ctx; LayoutInflater inflater = (LayoutInflater) ctx.getSystemService(Context.LAYOUT_INFLATER_SERVICE); if (!ctx.getResources().getBoolean(R.bool.is_tablet)) { View v = inflater.inflate(R.layout.top_bar, null); ImageView mtextureview_1 = (ImageView) v.findViewById(R.id.tView1); ImageButton button_main_points_interactions = (ImageButton) v.findViewById(R.id.button_01); ImageButton button_children_linkings = (ImageButton) v.findViewById(R.id.button_02); ImageButton button_move_map = (ImageButton) v.findViewById(R.id.button_03); /** this is the main points for changing the point A and the point B */ button_main_points_interactions.setOnClickListener(this); button_children_linkings.setOnClickListener(this); button_move_map.setOnClickListener(this); ab.setCustomView(v); } }
@AfterViews void loadLayout() { // Prepare for failure setResult(RESULT_CANCELED, new Intent()); // Inflate a "Done/Discard" custom action bar view. LayoutInflater inflater = (LayoutInflater) getActionBar().getThemedContext().getSystemService(LAYOUT_INFLATER_SERVICE); final View customActionBarView = inflater.inflate(R.layout.actionbar_custom_view_done_discard, null); customActionBarView .findViewById(R.id.actionbar_done) .setOnClickListener( new View.OnClickListener() { @Override public void onClick(View v) { // "Done" final Intent returnIntent = new Intent(); returnIntent.putExtra(RESULT_TEXT_KEY, taskText.getText().toString()); setResult(RESULT_OK, returnIntent); finish(); } }); customActionBarView .findViewById(R.id.actionbar_discard) .setOnClickListener( new View.OnClickListener() { @Override public void onClick(View v) { // "Cancel result already set" finish(); } }); // Show the custom action bar view and hide the normal Home icon and // title. final ActionBar actionBar = getActionBar(); actionBar.setDisplayOptions( ActionBar.DISPLAY_SHOW_CUSTOM, ActionBar.DISPLAY_SHOW_CUSTOM | ActionBar.DISPLAY_SHOW_HOME | ActionBar.DISPLAY_SHOW_TITLE); actionBar.setCustomView( customActionBarView, new ActionBar.LayoutParams( ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT)); }
@Override public void onCreate(Bundle savedInstanceState) { mContext = getApplicationContext(); super.onCreate(savedInstanceState); requestWindowFeature(Window.FEATURE_ACTION_BAR); requestWindowFeature(Window.FEATURE_ACTION_BAR_OVERLAY); ActionBar actionBar = getActionBar(); int displayOptions = ActionBar.DISPLAY_SHOW_HOME; actionBar.setDisplayOptions(0, displayOptions); displayOptions = ActionBar.DISPLAY_SHOW_CUSTOM; actionBar.setDisplayOptions(displayOptions, displayOptions); actionBar.setCustomView(R.layout.trim_menu); mSaveVideoTextView = (TextView) findViewById(R.id.start_trim); mSaveVideoTextView.setOnClickListener( new View.OnClickListener() { @Override public void onClick(View arg0) { trimVideo(); } }); mSaveVideoTextView.setEnabled(false); Intent intent = getIntent(); mUri = intent.getData(); mSrcVideoPath = intent.getStringExtra(PhotoPage.KEY_MEDIA_ITEM_PATH); setContentView(R.layout.trim_view); View rootView = findViewById(R.id.trim_view_root); mVideoView = (VideoView) rootView.findViewById(R.id.surface_view); mController = new TrimControllerOverlay(mContext); ((ViewGroup) rootView).addView(mController.getView()); mController.setListener(this); mController.setCanReplay(true); mVideoView.setOnErrorListener(this); mVideoView.setOnCompletionListener(this); mVideoView.setVideoURI(mUri); playVideo(); }
@Override public boolean onOptionsItemSelected(MenuItem item) { // TODO Auto-generated method stub switch (item.getItemId()) { case R.id.enterAmount: if (bar.getCustomView() != null) break; bar.setCustomView(R.layout.action_bar); bar.setDisplayOptions(ActionBar.DISPLAY_SHOW_CUSTOM | ActionBar.DISPLAY_SHOW_HOME); final EditText money = (EditText) bar.getCustomView().findViewById(R.id.moneyEditText); final Button go = (Button) bar.getCustomView().findViewById(R.id.goButton); go.setOnClickListener( new OnClickListener() { @Override public void onClick(View arg0) { // TODO Auto-generated method stub hideKeyboard(); double price = 0; try { price = Double.parseDouble(money.getText().toString()); } catch (NumberFormatException e) { Toast.makeText(getApplicationContext(), "Invalid number", Toast.LENGTH_SHORT) .show(); return; } ll.setVisibility(View.VISIBLE); ll2.setVisibility(View.INVISIBLE); startService( new Intent(FoodList.this, FoodListService.class) .putExtra(UtilClass._basePrice, price)); bar.setCustomView(null); } }); break; } return super.onOptionsItemSelected(item); }
@SuppressLint("InflateParams") private void setupActionBar() { ActionBar ab = getActionBar(); ab.setBackgroundDrawable(new ColorDrawable(Color.parseColor("#253939"))); ab.setDisplayShowCustomEnabled(true); ab.setDisplayShowTitleEnabled(false); ab.setIcon(R.drawable.ic_launcher); LayoutInflater inflator = (LayoutInflater) this.getSystemService(Context.LAYOUT_INFLATER_SERVICE); View v = inflator.inflate(R.layout.comment_view_action_bar, null); TextView titleTV = (TextView) v.findViewById(R.id.comment_action_bar_title); titleTV.setText(this.title); ab.setCustomView(v); ab.setDisplayHomeAsUpEnabled(true); }