List of usage examples for android.widget LinearLayout HORIZONTAL
int HORIZONTAL
To view the source code for android.widget LinearLayout HORIZONTAL.
Click Source Link
From source file:com.ereader.client.ui.view.ScrollingTabsView.java
public ScrollingTabsView(Context context, AttributeSet attrs, int defStyle) { super(context, attrs); this.mContext = context; mDividerMarginTop = (int) (getResources().getDisplayMetrics().density * mDividerMarginTop); mDividerMarginBottom = (int) (getResources().getDisplayMetrics().density * mDividerMarginBottom); mDividerWidth = (int) (getResources().getDisplayMetrics().density * mDividerWidth); final TypedArray a = context.obtainStyledAttributes(attrs, R.styleable.ViewPagerExtensions, defStyle, 0); mDividerColor = a.getColor(R.styleable.ViewPagerExtensions_dividerColor, mDividerColor); mDividerMarginTop = a.getDimensionPixelSize(R.styleable.ViewPagerExtensions_dividerMarginTop, mDividerMarginTop);//from ww w.j a v a 2 s . co m mDividerMarginBottom = a.getDimensionPixelSize(R.styleable.ViewPagerExtensions_dividerMarginBottom, mDividerMarginBottom); mDividerDrawable = a.getDrawable(R.styleable.ViewPagerExtensions_dividerDrawable); a.recycle(); this.setHorizontalScrollBarEnabled(false); this.setHorizontalFadingEdgeEnabled(false); mContainer = new LinearLayout(context); LinearLayout.LayoutParams params = new LinearLayout.LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT); mContainer.setLayoutParams(params); mContainer.setOrientation(LinearLayout.HORIZONTAL); mContainer.setGravity(Gravity.CENTER); this.addView(mContainer); }
From source file:com.yahala.ui.Views.PagerSlidingTabStrip.java
public PagerSlidingTabStrip(Context context, AttributeSet attrs, int defStyle) { super(context, attrs, defStyle); setFillViewport(true);//from w w w . ja v a2 s . c o m setWillNotDraw(false); tabsContainer = new LinearLayout(context); tabsContainer.setOrientation(LinearLayout.HORIZONTAL); tabsContainer.setLayoutParams(new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT)); addView(tabsContainer); DisplayMetrics dm = getResources().getDisplayMetrics(); scrollOffset = (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, scrollOffset, dm); indicatorHeight = (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, indicatorHeight, dm); underlineHeight = (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, underlineHeight, dm); dividerPadding = (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, dividerPadding, dm); tabPadding = (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, tabPadding, dm); dividerWidth = (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, dividerWidth, dm); tabTextSize = (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_SP, tabTextSize, dm); // get system attrs (android:textSize and android:textColor) TypedArray a = context.obtainStyledAttributes(attrs, ATTRS); tabTextSize = a.getDimensionPixelSize(0, tabTextSize); tabTextColor = a.getColor(1, tabTextColor); a.recycle(); // get custom attrs a = context.obtainStyledAttributes(attrs, R.styleable.PagerSlidingTabStrip); indicatorColor = a.getColor(R.styleable.PagerSlidingTabStrip_indicatorColor, indicatorColor); underlineColor = a.getColor(R.styleable.PagerSlidingTabStrip_underlineColor, underlineColor); dividerColor = a.getColor(R.styleable.PagerSlidingTabStrip_dividerColor, dividerColor); indicatorHeight = a.getDimensionPixelSize(R.styleable.PagerSlidingTabStrip_indicatorHeight, indicatorHeight); underlineHeight = a.getDimensionPixelSize(R.styleable.PagerSlidingTabStrip_underlineHeight, underlineHeight); dividerPadding = a.getDimensionPixelSize(R.styleable.PagerSlidingTabStrip_dividerPadding1, dividerPadding); tabPadding = a.getDimensionPixelSize(R.styleable.PagerSlidingTabStrip_tabPaddingLeftRight, tabPadding); tabBackgroundResId = a.getResourceId(R.styleable.PagerSlidingTabStrip_tabBackground2, tabBackgroundResId); shouldExpand = a.getBoolean(R.styleable.PagerSlidingTabStrip_shouldExpand, shouldExpand); scrollOffset = a.getDimensionPixelSize(R.styleable.PagerSlidingTabStrip_scrollOffset, scrollOffset); textAllCaps = a.getBoolean(R.styleable.PagerSlidingTabStrip_textAllCaps1, textAllCaps); tabSwitch = a.getBoolean(R.styleable.PagerSlidingTabStrip_tabSwitch, tabSwitch); tabTextColor = a.getColor(R.styleable.PagerSlidingTabStrip_activateTextColor, tabTextColor); tabDeactivateTextColor = a.getColor(R.styleable.PagerSlidingTabStrip_deactivateTextColor, tabDeactivateTextColor); a.recycle(); rectPaint = new Paint(); rectPaint.setAntiAlias(true); rectPaint.setStyle(Style.FILL); dividerPaint = new Paint(); dividerPaint.setAntiAlias(true); dividerPaint.setStrokeWidth(dividerWidth); defaultTabLayoutParams = new LinearLayout.LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.MATCH_PARENT); expandedTabLayoutParams = new LinearLayout.LayoutParams(0, LayoutParams.MATCH_PARENT, 1.0f); if (locale == null) { locale = getResources().getConfiguration().locale; } }
From source file:com.apptentive.android.sdk.module.engagement.interaction.view.TextModalInteractionView.java
@Override public void doOnCreate(final Activity activity, Bundle onSavedInstanceState) { activity.setContentView(R.layout.apptentive_textmodal_interaction_center); TextView title = (TextView) activity.findViewById(R.id.title); if (interaction.getTitle() == null) { title.setVisibility(View.GONE); } else {/* w ww. j a va 2s .c o m*/ title.setText(interaction.getTitle()); } TextView body = (TextView) activity.findViewById(R.id.body); if (interaction.getBody() == null) { body.setVisibility(View.GONE); } else { body.setText(interaction.getBody()); } LinearLayout bottomArea = (LinearLayout) activity.findViewById(R.id.bottom_area); List<Action> actions = interaction.getActions().getAsList(); boolean vertical; if (actions != null && !actions.isEmpty()) { int totalChars = 0; for (Action button : actions) { totalChars += button.getLabel().length(); } if (actions.size() == 1) { vertical = false; } else if (actions.size() == 2) { vertical = totalChars > MAX_TEXT_LENGTH_FOR_TWO_BUTTONS; } else if (actions.size() == 3) { vertical = totalChars > MAX_TEXT_LENGTH_FOR_THREE_BUTTONS; } else if (actions.size() == 4) { vertical = totalChars > MAX_TEXT_LENGTH_FOR_FOUR_BUTTONS; } else { vertical = true; } if (vertical) { bottomArea.setOrientation(LinearLayout.VERTICAL); } else { bottomArea.setOrientation(LinearLayout.HORIZONTAL); } for (int i = 0; i < actions.size(); i++) { final Action buttonAction = actions.get(i); final int position = i; ApptentiveDialogButton button = new ApptentiveDialogButton(activity); button.setText(buttonAction.getLabel()); switch (buttonAction.getType()) { case dismiss: button.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { JSONObject data = new JSONObject(); try { data.put(TextModalInteraction.EVENT_KEY_ACTION_ID, buttonAction.getId()); data.put(Action.KEY_LABEL, buttonAction.getLabel()); data.put(TextModalInteraction.EVENT_KEY_ACTION_POSITION, position); } catch (JSONException e) { Log.e("Error creating Event data object.", e); } EngagementModule.engageInternal(activity, interaction, TextModalInteraction.EVENT_NAME_DISMISS, data.toString()); activity.finish(); } }); break; case interaction: button.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { LaunchInteractionAction launchInteractionButton = (LaunchInteractionAction) buttonAction; List<Invocation> invocations = launchInteractionButton.getInvocations(); String interactionIdToLaunch = null; for (Invocation invocation : invocations) { if (invocation.isCriteriaMet(activity)) { interactionIdToLaunch = invocation.getInteractionId(); break; } } Interaction invokedInteraction = null; if (interactionIdToLaunch != null) { Interactions interactions = InteractionManager.getInteractions(activity); if (interactions != null) { invokedInteraction = interactions.getInteraction(interactionIdToLaunch); } } JSONObject data = new JSONObject(); try { data.put(TextModalInteraction.EVENT_KEY_ACTION_ID, buttonAction.getId()); data.put(Action.KEY_LABEL, buttonAction.getLabel()); data.put(TextModalInteraction.EVENT_KEY_ACTION_POSITION, position); data.put(TextModalInteraction.EVENT_KEY_INVOKED_INTERACTION_ID, invokedInteraction == null ? JSONObject.NULL : invokedInteraction.getId()); } catch (JSONException e) { Log.e("Error creating Event data object.", e); } EngagementModule.engageInternal(activity, interaction, TextModalInteraction.EVENT_NAME_INTERACTION, data.toString()); if (invokedInteraction != null) { EngagementModule.launchInteraction(activity, invokedInteraction); } activity.finish(); } }); break; } bottomArea.addView(button); } } else { bottomArea.setVisibility(View.GONE); } }
From source file:com.uzmap.pkg.uzmodules.uzBMap.mode.Billboard.java
@SuppressWarnings("deprecation") public View billboardView() { LinearLayout billboardLayout = new LinearLayout(context); LayoutParams layoutParams = null;/*from w ww . j av a 2 s. c om*/ if (bgImg != null) { billboardLayout.setBackgroundDrawable(new BitmapDrawable(bgImg)); layoutParams = new LayoutParams(UZCoreUtil.dipToPix(width), UZCoreUtil.dipToPix(height)); } else { billboardLayout.setBackgroundResource(UZResourcesIDFinder.getResDrawableID("mo_bmap_popupmap")); layoutParams = new LayoutParams(LayoutParams.WRAP_CONTENT, UZCoreUtil.dipToPix(height)); } billboardLayout.setLayoutParams(layoutParams); billboardLayout.setOrientation(LinearLayout.HORIZONTAL); if (getIconAlign().equals("left")) { if (iconStr != null && !iconStr.isEmpty()) billboardLayout.addView(icon()); billboardLayout.addView(titleLayout()); } else { billboardLayout.addView(titleLayout()); if (iconStr != null && !iconStr.isEmpty()) billboardLayout.addView(icon()); } return billboardLayout; }
From source file:com.waz.zclient.ui.cursor.CursorToolbar.java
public CursorToolbar(Context context, AttributeSet attrs, int defStyleAttr) { super(context, attrs, defStyleAttr); detector = new GestureDetectorCompat(getContext(), gestureListener); setOrientation(LinearLayout.HORIZONTAL); buttonWidth = getResources().getDimensionPixelSize(R.dimen.new_cursor_menu_button_width); }
From source file:bigshots.people_helping_people.scroll_iew_lib.PagerSlidingTabStrip.java
public PagerSlidingTabStrip(Context context, AttributeSet attrs, int defStyle) { super(context, attrs, defStyle); setFillViewport(true);/*from ww w . j a va 2s .c om*/ setWillNotDraw(false); tabsContainer = new LinearLayout(context); tabsContainer.setOrientation(LinearLayout.HORIZONTAL); tabsContainer.setLayoutParams(new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT)); addView(tabsContainer); DisplayMetrics dm = getResources().getDisplayMetrics(); scrollOffset = (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, scrollOffset, dm); indicatorHeight = (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, indicatorHeight, dm); underlineHeight = (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, underlineHeight, dm); dividerPadding = (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, dividerPadding, dm); tabPadding = (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, tabPadding, dm); dividerWidth = (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, dividerWidth, dm); tabTextSize = (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_SP, tabTextSize, dm); // get system attrs (android:textSize and android:textColor) TypedArray a = context.obtainStyledAttributes(attrs, ATTRS); tabTextSize = a.getDimensionPixelSize(0, tabTextSize); tabTextColor = a.getColor(1, tabTextColor); a.recycle(); // get custom attrs indicatorColor = getResources().getColor(R.color.current_charity_color); underlineColor = indicatorColor; dividerColor = 0xffffffff; tabBackgroundResId = 0x00000000; rectPaint = new Paint(); rectPaint.setAntiAlias(true); rectPaint.setStyle(Style.FILL); dividerPaint = new Paint(); dividerPaint.setAntiAlias(true); dividerPaint.setStrokeWidth(dividerWidth); defaultTabLayoutParams = new LinearLayout.LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.MATCH_PARENT); expandedTabLayoutParams = new LinearLayout.LayoutParams(0, LayoutParams.MATCH_PARENT, 1.0f); if (locale == null) { locale = getResources().getConfiguration().locale; } }
From source file:com.github.johnpersano.supertoasts.demo.views.TabStrip.java
public TabStrip(Context context, AttributeSet attrs, int defStyle) { super(context, attrs, defStyle); setFillViewport(true);/*from w w w. j av a2s . c o m*/ setWillNotDraw(false); tabsContainer = new LinearLayout(context); tabsContainer.setOrientation(LinearLayout.HORIZONTAL); tabsContainer.setLayoutParams(new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT)); addView(tabsContainer); DisplayMetrics dm = getResources().getDisplayMetrics(); scrollOffset = (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, scrollOffset, dm); indicatorHeight = (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, indicatorHeight, dm); underlineHeight = (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, underlineHeight, dm); tabPadding = (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, tabPadding, dm); tabTextSize = (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_SP, tabTextSize, dm); indicatorPadding = (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_SP, indicatorPadding, dm); // get system attrs (android:textSize and android:textColor) TypedArray a = context.obtainStyledAttributes(attrs, ATTRS); tabTextSize = a.getDimensionPixelSize(0, tabTextSize); a.recycle(); a = context.obtainStyledAttributes(attrs, R.styleable.TabStrip); indicatorColor = a.getColor(R.styleable.TabStrip_TabStripIndicatorColor, indicatorColor); underlineColor = a.getColor(R.styleable.TabStrip_TabStripUnderlineColor, underlineColor); indicatorHeight = a.getDimensionPixelSize(R.styleable.TabStrip_TabStripIndicatorHeight, indicatorHeight); underlineHeight = a.getDimensionPixelSize(R.styleable.TabStrip_TabStripUnderlineHeight, underlineHeight); tabPadding = a.getDimensionPixelSize(R.styleable.TabStrip_TabStripTabPaddingLeftRight, tabPadding); tabBackgroundResId = a.getResourceId(R.styleable.TabStrip_TabStripTabBackground, tabBackgroundResId); shouldExpand = a.getBoolean(R.styleable.TabStrip_TabStripShouldExpand, shouldExpand); scrollOffset = a.getDimensionPixelSize(R.styleable.TabStrip_TabStripScrollOffset, scrollOffset); tabSwitch = a.getBoolean(R.styleable.TabStrip_TabStripTabSwitch, tabSwitch); tabTextColor = a.getColor(R.styleable.TabStrip_TabStripActivateTextColor, tabTextColor); tabDeactivateTextColor = a.getColor(R.styleable.TabStrip_TabStripDeactivateTextColor, tabDeactivateTextColor); indicatorPadding = a.getDimensionPixelSize(R.styleable.TabStrip_TabStripIndicatorPadding, indicatorPadding); a.recycle(); rectPaint = new Paint(); rectPaint.setAntiAlias(true); rectPaint.setStyle(Style.FILL); defaultTabLayoutParams = new LinearLayout.LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.MATCH_PARENT); expandedTabLayoutParams = new LinearLayout.LayoutParams(0, LayoutParams.MATCH_PARENT, 1.0f); if (locale == null) { locale = getResources().getConfiguration().locale; } }
From source file:com.metinkale.prayerapp.utils.PagerSlidingTabStrip.java
public PagerSlidingTabStrip(Context context, AttributeSet attrs, int defStyle) { super(context, attrs, defStyle); setFillViewport(true);//w ww .j a v a2 s . com setWillNotDraw(false); tabsContainer = new LinearLayout(context); tabsContainer.setOrientation(LinearLayout.HORIZONTAL); tabsContainer.setLayoutParams( new LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT)); addView(tabsContainer); DisplayMetrics dm = getResources().getDisplayMetrics(); scrollOffset = (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, scrollOffset, dm); indicatorHeight = (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, indicatorHeight, dm); underlineHeight = (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, underlineHeight, dm); dividerPadding = (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, dividerPadding, dm); tabPadding = (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, tabPadding, dm); int dividerWidth = (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 0, dm); tabTextSize = (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_SP, tabTextSize, dm); // get system attrs (android:textSize and android:textColor) TypedArray a = context.obtainStyledAttributes(attrs, ATTRS); tabTextSize = a.getDimensionPixelSize(0, tabTextSize); tabTextColor = a.getColor(1, tabTextColor); a.recycle(); // get custom attrs a = context.obtainStyledAttributes(attrs, R.styleable.PagerSlidingTabStrip); indicatorColor = a.getColor(R.styleable.PagerSlidingTabStrip_pstsIndicatorColor, indicatorColor); underlineColor = a.getColor(R.styleable.PagerSlidingTabStrip_pstsUnderlineColor, underlineColor); dividerColor = a.getColor(R.styleable.PagerSlidingTabStrip_pstsDividerColor, dividerColor); indicatorHeight = a.getDimensionPixelSize(R.styleable.PagerSlidingTabStrip_pstsIndicatorHeight, indicatorHeight); underlineHeight = a.getDimensionPixelSize(R.styleable.PagerSlidingTabStrip_pstsUnderlineHeight, underlineHeight); dividerPadding = a.getDimensionPixelSize(R.styleable.PagerSlidingTabStrip_pstsDividerPadding, dividerPadding); tabPadding = a.getDimensionPixelSize(R.styleable.PagerSlidingTabStrip_pstsTabpaddingStartRight, tabPadding); tabBackgroundResId = a.getResourceId(R.styleable.PagerSlidingTabStrip_pstsTabBackground, tabBackgroundResId); shouldExpand = a.getBoolean(R.styleable.PagerSlidingTabStrip_pstsShouldExpand, shouldExpand); scrollOffset = a.getDimensionPixelSize(R.styleable.PagerSlidingTabStrip_pstsScrollOffset, scrollOffset); textAllCaps = a.getBoolean(R.styleable.PagerSlidingTabStrip_pstsTextAllCaps, textAllCaps); a.recycle(); rectPaint = new Paint(); rectPaint.setAntiAlias(true); rectPaint.setStyle(Style.FILL); dividerPaint = new Paint(); dividerPaint.setAntiAlias(true); dividerPaint.setStrokeWidth(dividerWidth); defaultTabLayoutParams = new LinearLayout.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.MATCH_PARENT); expandedTabLayoutParams = new LinearLayout.LayoutParams(0, ViewGroup.LayoutParams.MATCH_PARENT, 1.0f); if (locale == null) { locale = getResources().getConfiguration().locale; } }
From source file:com.nxt.njitong.page.PagerSlidingTabStrip.java
public PagerSlidingTabStrip(Context context, AttributeSet attrs, int defStyle) { super(context, attrs, defStyle); setFillViewport(true);//from www . j a va 2 s . co m setWillNotDraw(false); tabsContainer = new LinearLayout(context); tabsContainer.setOrientation(LinearLayout.HORIZONTAL); tabsContainer.setLayoutParams(new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT)); addView(tabsContainer); DisplayMetrics dm = getResources().getDisplayMetrics(); scrollOffset = (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, scrollOffset, dm); indicatorHeight = (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, indicatorHeight, dm); underlineHeight = (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, underlineHeight, dm); dividerPadding = (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, dividerPadding, dm); tabPadding = (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, tabPadding, dm); int dividerWidth = 1; dividerWidth = (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, dividerWidth, dm); tabTextSize = (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_SP, tabTextSize, dm); // get system attrs (android:textSize and android:textColor) TypedArray a = context.obtainStyledAttributes(attrs, ATTRS); tabTextSize = a.getDimensionPixelSize(0, tabTextSize); tabTextColor = a.getColor(1, tabTextColor); a.recycle(); // get custom attrs a = context.obtainStyledAttributes(attrs, R.styleable.PagerSlidingTabStrip); indicatorColor = a.getColor(R.styleable.PagerSlidingTabStrip_pstsIndicatorColor, indicatorColor); underlineColor = a.getColor(R.styleable.PagerSlidingTabStrip_pstsUnderlineColor, underlineColor); dividerColor = a.getColor(R.styleable.PagerSlidingTabStrip_pstsDividerColor, dividerColor); indicatorHeight = a.getDimensionPixelSize(R.styleable.PagerSlidingTabStrip_pstsIndicatorHeight, indicatorHeight); underlineHeight = a.getDimensionPixelSize(R.styleable.PagerSlidingTabStrip_pstsUnderlineHeight, underlineHeight); dividerPadding = a.getDimensionPixelSize(R.styleable.PagerSlidingTabStrip_pstsDividerPadding, dividerPadding); tabPadding = a.getDimensionPixelSize(R.styleable.PagerSlidingTabStrip_pstsTabPaddingLeftRight, tabPadding); tabBackgroundResId = a.getResourceId(R.styleable.PagerSlidingTabStrip_pstsTabBackground, tabBackgroundResId); shouldExpand = a.getBoolean(R.styleable.PagerSlidingTabStrip_pstsShouldExpand, shouldExpand); scrollOffset = a.getDimensionPixelSize(R.styleable.PagerSlidingTabStrip_pstsScrollOffset, scrollOffset); textAllCaps = a.getBoolean(R.styleable.PagerSlidingTabStrip_pstsTextAllCaps, textAllCaps); a.recycle(); rectPaint = new Paint(); rectPaint.setAntiAlias(true); rectPaint.setStyle(Style.FILL); dividerPaint = new Paint(); dividerPaint.setAntiAlias(true); dividerPaint.setStrokeWidth(dividerWidth); defaultTabLayoutParams = new LinearLayout.LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.MATCH_PARENT); expandedTabLayoutParams = new LinearLayout.LayoutParams(0, LayoutParams.MATCH_PARENT, 1.0f); if (locale == null) { locale = getResources().getConfiguration().locale; } }
From source file:com.thelastcrusade.soundstream.components.ConnectFragment.java
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View v = inflater.inflate(R.layout.fragment_connect, container, false); ((CoreActivity) getActivity()).hidePlaybar(); int rotation = getActivity().getWindowManager().getDefaultDisplay().getRotation(); if (rotation == Surface.ROTATION_270 || rotation == Surface.ROTATION_90) { ((LinearLayout) v).setOrientation(LinearLayout.HORIZONTAL); LinearLayout.LayoutParams clickableParams = new LinearLayout.LayoutParams(0, LinearLayout.LayoutParams.MATCH_PARENT, 1); clickableParams.setMargins(5, 10, 10, 10); v.findViewById(R.id.join).setLayoutParams(clickableParams); clickableParams.setMargins(10, 10, 5, 10); v.findViewById(R.id.create).setLayoutParams(clickableParams); } else {/*from w ww.j a va 2 s . c o m*/ ((LinearLayout) v).setOrientation(LinearLayout.VERTICAL); LinearLayout.LayoutParams clickableParams = new LinearLayout.LayoutParams( LinearLayout.LayoutParams.MATCH_PARENT, 0, 1); clickableParams.setMargins(10, 5, 10, 10); v.findViewById(R.id.join).setLayoutParams(clickableParams); clickableParams.setMargins(10, 10, 10, 5); v.findViewById(R.id.create).setLayoutParams(clickableParams); } View create = v.findViewById(R.id.create); create.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { Transitions.transitionToHome((CoreActivity) getActivity()); ((CoreActivity) getActivity()).enableSlidingMenu(); //add the playbar fragment onto the active content view ((CoreActivity) getActivity()).showPlaybar(); } }); create.setContentDescription(ContentDescriptionUtils.CREATE); this.joinView = v.findViewById(R.id.join); this.joinView.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { new WithBluetoothEnabled(getActivity(), getConnectionService()).run(new Runnable() { @Override public void run() { getConnectionService().broadcastSelfAsGuest(getActivity()); } }); } }); joinView.setContentDescription(ContentDescriptionUtils.CONNECT); TextView joinText = (TextView) v.findViewById(R.id.join_network_id); joinText.setText(String.format(getString(R.string.join_network), BluetoothUtils.getLocalBluetoothName())); if (savedInstanceState != null) { isSearching = savedInstanceState.getBoolean(SEARCHING_TAG); if (isSearching) setJoinToSearchingState(); } return v; }