List of usage examples for android.widget TextView setSingleLine
public void setSingleLine()
From source file:com.abcs.huaqiaobang.tljr.news.tabs.PagerSlidingTabStrip.java
private void addTextTab(final int position, String title) { TextView tab = new TextView(getContext()); tab.setText(title);// ww w. j a va 2 s . com tab.setGravity(Gravity.CENTER); // DisplayMetrics dm = getResources().getDisplayMetrics(); // tab.setWidth(dm.widthPixels*2/3); tab.setSingleLine(); addTab(position, tab); }
From source file:com.next.PagerSlidingTabStrip.java
private void addTextTab(final int position, String title) { tabType = TAB_TYPE_TEXT;//from w ww .j ava 2 s . c o m TextView tab = new TextView(getContext()); tab.setText(title); tab.setGravity(Gravity.CENTER); tab.setSingleLine(); addTab(position, tab); }
From source file:com.yomii.view.PagerSlidingTab.java
private void addTextTab(final int position, String title) { TextView tab = new TextView(getContext()); tab.setText(title);/*w w w. ja v a2 s. c o m*/ tab.setFocusable(true); tab.setGravity(Gravity.CENTER); tab.setSingleLine(); tab.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { pager.setCurrentItem(position); if (delegateTabClickListener != null) delegateTabClickListener.onClick(v); } }); tabsContainer.addView(tab); }
From source file:com.astuetz.PagerSlidingTabStripPlus.java
private void addTextTab(final int position, String title) { TextView tab = new TextView(getContext()); tab.setText(title);/* w ww . j ava 2s.c o m*/ tab.setGravity(tabsGravity); tab.setSingleLine(); addTab(position, tab); }
From source file:cn.mailchat.view.PagerSlidingTabStrip.java
private void addTextTab(final int position, String title) { //layout//from ww w. ja v a2 s . c om RelativeLayout tabLayout = new RelativeLayout(getContext()); RelativeLayout.LayoutParams layoutParams = new RelativeLayout.LayoutParams( RelativeLayout.LayoutParams.MATCH_PARENT, RelativeLayout.LayoutParams.WRAP_CONTENT); tabLayout.setLayoutParams(layoutParams); RelativeLayout.LayoutParams textParams = new RelativeLayout.LayoutParams( RelativeLayout.LayoutParams.WRAP_CONTENT, RelativeLayout.LayoutParams.WRAP_CONTENT); textParams.addRule(RelativeLayout.CENTER_IN_PARENT); //tab TextView tab = new TextView(getContext()); tab.setId(100 + position); tab.setText(title); tab.setGravity(Gravity.CENTER); tab.setSingleLine(); tabLayout.addView(tab, textParams); //??? RelativeLayout.LayoutParams viewParams = new RelativeLayout.LayoutParams( RelativeLayout.LayoutParams.WRAP_CONTENT, RelativeLayout.LayoutParams.WRAP_CONTENT); viewParams.addRule(RelativeLayout.RIGHT_OF, tab.getId()); viewParams.addRule(RelativeLayout.CENTER_VERTICAL); View view = new View(getContext()); ViewGroup.LayoutParams vParams = new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT); view.setLayoutParams(vParams); tabLayout.addView(view, viewParams); addTab(position, tabLayout); }
From source file:net.fengg.lib.tabsliding.TabSlidingView.java
private void addTextIconTab(final int position, String title, int resId) { TextView text = new TextView(getContext()); text.setText(title);/* w w w. j av a 2 s.c o m*/ text.setGravity(Gravity.CENTER); text.setSingleLine(); ImageButton icon = new ImageButton(getContext()); icon.setImageResource(resId); icon.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { pager.setCurrentItem(position); } }); LinearLayout linearLayout = new LinearLayout(getContext()); linearLayout.setOrientation(titileIconDirection); if (iconAbove) { linearLayout.addView(icon, shouldExpand ? expandedTabLayoutParams : defaultTabLayoutParams); linearLayout.addView(text, shouldExpand ? expandedTabLayoutParams : defaultTabLayoutParams); } else { linearLayout.addView(text, shouldExpand ? expandedTabLayoutParams : defaultTabLayoutParams); linearLayout.addView(icon, shouldExpand ? expandedTabLayoutParams : defaultTabLayoutParams); } addTab(position, linearLayout); }
From source file:ru.moscow.tuzlukov.sergey.weatherlog.MainActivity.java
private void makePlot(double minTemp, double maxTemp) { //all graphics should have a room, to be visible in plot viewport, i.e. max from greatest and min from the least ordinates: double lowLimit = Math.min(Math.round(minTemp), temperatureLimit2); double highLimit = Math.max(Math.round(maxTemp), temperatureLimit1); //round for drawing scale with 5-degrees step: lowLimit = Math.floor(lowLimit / 5.0) * 5.0; highLimit = Math.ceil(highLimit / 5.0) * 5.0; //fill in the plot with all data series: List<DataPoint> dataPoints = new ArrayList<>(); for (Long time : temperatureMap.keySet()) dataPoints.add(new DataPoint(time, temperatureMap.get(time))); dataPoints.add(new DataPoint(currentTime, dataPoints.get(dataPoints.size() - 1).getY())); //fix for using data from cache LineGraphSeries<DataPoint> temperatureSeries = new LineGraphSeries<>( dataPoints.toArray(new DataPoint[dataPoints.size()])); LineGraphSeries<DataPoint> temperatureLimit1Series = new LineGraphSeries<>( new DataPoint[] { new DataPoint(currentTimeMinus24h, temperatureLimit1), new DataPoint(currentTime, temperatureLimit1) }); LineGraphSeries<DataPoint> temperatureLimit2Series = new LineGraphSeries<>( new DataPoint[] { new DataPoint(currentTimeMinus24h, temperatureLimit2), new DataPoint(currentTime, temperatureLimit2) }); graphView.addSeries(temperatureSeries); graphView.addSeries(temperatureLimit1Series); graphView.addSeries(temperatureLimit2Series); //lay out the plot: GridLabelRenderer gridLabelRenderer = graphView.getGridLabelRenderer(); Viewport viewport = graphView.getViewport(); //adjust grid settings: gridLabelRenderer.setGridStyle(GridLabelRenderer.GridStyle.BOTH); gridLabelRenderer.setHighlightZeroLines(true); gridLabelRenderer.setHorizontalLabelsVisible(false); gridLabelRenderer.setVerticalLabelsVisible(true); //tune view of lines: viewport.setBackgroundColor(getResources().getColor(R.color.plot_viewport_background_color)); temperatureSeries.setColor(getResources().getColor(R.color.temperature_series_color)); temperatureSeries.setThickness(2);/*ww w. j av a2s. c o m*/ temperatureLimit1Series.setColor(getResources().getColor(R.color.limit1_series_color)); temperatureLimit1Series.setThickness(2); temperatureLimit2Series.setColor(getResources().getColor(R.color.limit2_series_color)); temperatureLimit2Series.setThickness(2); //set viewport bounds and set the scale: //...in horizontal: gridLabelRenderer.setNumHorizontalLabels(2); viewport.setMinX(currentTimeMinus24h); viewport.setMaxX(currentTime); viewport.setXAxisBoundsManual(true); //...in vertical: int numVerticalLabels = (int) (highLimit - lowLimit) / 5 + 1; numVerticalLabels = numVerticalLabels < 2 ? 2 : numVerticalLabels; gridLabelRenderer.setNumVerticalLabels(numVerticalLabels); viewport.setMinY(lowLimit); viewport.setMaxY(highLimit); viewport.setYAxisBoundsManual(true); //set horizontal labels: LinearLayout llHorizontalLabels = (LinearLayout) findViewById(R.id.llHorizontalLabels); if (llHorizontalLabels.getChildCount() == 0) { LinearLayout.LayoutParams params = (LinearLayout.LayoutParams) llHorizontalLabels.getLayoutParams(); params.bottomMargin = 0; llHorizontalLabels.setLayoutParams(params); gridLabelRenderer.setTextSize(gridLabelRenderer.getTextSize() - 2); //make text a bit smaller for (int n = -24; n < 0; n += 3) { TextView textView = new TextView(MainActivity.this); textView.setText(String.valueOf(n)); textView.setGravity(Gravity.START); textView.setSingleLine(); params = new LinearLayout.LayoutParams(LinearLayout.LayoutParams.MATCH_PARENT, LinearLayout.LayoutParams.WRAP_CONTENT, 1.0f / 8.0f); textView.setLayoutParams(params); textView.setTextSize(TypedValue.COMPLEX_UNIT_PX, gridLabelRenderer.getTextSize()); textView.setTextColor(gridLabelRenderer.getVerticalLabelsColor()); llHorizontalLabels.addView(textView); } TextView tvZeroLabel = (TextView) findViewById(R.id.tvZeroLabel); tvZeroLabel.setText("-0 " + getString(R.string.hours_caption)); tvZeroLabel.setTextSize(TypedValue.COMPLEX_UNIT_PX, gridLabelRenderer.getTextSize()); tvZeroLabel.setTextColor(gridLabelRenderer.getVerticalLabelsColor()); tvZeroLabel.setVisibility(View.VISIBLE); gridLabelRenderer.setPadding(gridLabelRenderer.getPadding() + 2); //make plot a bit smaller } }
From source file:cn.com.zzwfang.view.indicator.PagerSlidingTabStrip.java
private void addTextTab(final int position, String title) { TextView tab = new TextView(getContext()); tab.setLayoutParams(getLayoutParams()); tab.setText(title);//w ww . j a va2s.co m tab.setFocusable(true); tab.setGravity(Gravity.CENTER); tab.setSingleLine(); tab.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { pager.setCurrentItem(position); } }); tabsContainer.addView(tab); }
From source file:net.coding.program.common.PagerSlidingTabStrip.java
private void addTextTab(final int position, String title) { TextView tab = new TextView(getContext()); tab.setText(title);//from w w w. j a v a2 s . c o m tab.setGravity(Gravity.CENTER); tab.setTextSize(24); tab.setSingleLine(); addTab(position, tab); }
From source file:com.ekuater.labelchat.ui.widget.PagerSlidingTabStrip.java
private void addIconTextTab(final int position, String title, int icon) { TextView tab = new TextView(getContext()); tab.setText(title);// w ww . ja va 2 s . c o m tab.setCompoundDrawablesWithIntrinsicBounds(null, getResources().getDrawable(icon), null, null); tab.setGravity(Gravity.CENTER); tab.setSingleLine(); addTab(position, tab); }