List of usage examples for android.widget LinearLayout VERTICAL
int VERTICAL
To view the source code for android.widget LinearLayout VERTICAL.
Click Source Link
From source file:com.normalexception.app.rx8club.dialog.MoveThreadDialog.java
/** * Constructor for method that is used to move a thread from one * forum to another //from w w w. ja v a 2 s.com * @param ctx The source context/activity * @param securitytoken The security token for the session * @param src_thread The source thread * @param tTitle The new thread title * @param options The options from the move dialog */ public MoveThreadDialog(final Fragment ctx, final String securitytoken, final String src_thread, String tTitle, final Map<String, Integer> options) { builder = new AlertDialog.Builder(ctx.getActivity()); // Set up the input final TextView lbl_title = new TextView(ctx.getActivity()); final EditText title = new EditText(ctx.getActivity()); final TextView lbl_dest = new TextView(ctx.getActivity()); final Spinner destination = new Spinner(ctx.getActivity()); // Lets make sure the user didn't accidentally click this DialogInterface.OnClickListener dialogClickListener = new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { switch (which) { case DialogInterface.BUTTON_POSITIVE: newTitle = title.getText().toString(); String selectText = destination.getSelectedItem().toString(); selection = options.get(selectText); AsyncTask<Void, String, Void> updaterTask = new AsyncTask<Void, String, Void>() { @Override protected Void doInBackground(Void... params) { try { HtmlFormUtils.adminMoveThread(securitytoken, src_thread, newTitle, Integer.toString(selection)); } catch (Exception e) { Log.e(TAG, "Error Submitting Form For Move", e); } return null; } @Override protected void onPostExecute(Void result) { ctx.getFragmentManager().popBackStack(); CategoryFragment cFrag = (CategoryFragment) ((ThreadFragment) ctx).getParentCategory(); cFrag.refreshView(); } }; updaterTask.execute(); break; case DialogInterface.BUTTON_NEGATIVE: break; } } }; // Specify the type of input expected lbl_title.setText("Thread Title"); lbl_title.setTextColor(Color.WHITE); lbl_dest.setText("Desination"); lbl_dest.setTextColor(Color.WHITE); title.setInputType(InputType.TYPE_CLASS_TEXT); title.setText(tTitle); List<String> values = new ArrayList<String>(); values.addAll(options.keySet()); ArrayAdapter<String> dataAdapter = new ArrayAdapter<String>(ctx.getActivity(), android.R.layout.simple_spinner_item, values); dataAdapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item); destination.setAdapter(dataAdapter); LinearLayout ll = new LinearLayout(ctx.getActivity()); ll.setOrientation(LinearLayout.VERTICAL); ll.addView(lbl_title); ll.addView(title); ll.addView(lbl_dest); ll.addView(destination); builder.setView(ll); builder.setTitle(R.string.dialogMoveThread).setPositiveButton(R.string.Move, dialogClickListener) .setNegativeButton(R.string.cancel, dialogClickListener); }
From source file:edu.cscie71.imm.slacker.plugin.Slacker.java
private void openAuthScreen() { Runnable runnable = new Runnable() { @SuppressLint("NewApi") public void run() { dialog = new Dialog(cordova.getActivity(), android.R.style.Theme_NoTitleBar); dialog.getWindow().getAttributes().windowAnimations = android.R.style.Animation_Dialog; dialog.requestWindowFeature(Window.FEATURE_NO_TITLE); dialog.setCancelable(true);// www. jav a 2s .c om LinearLayout mainLayout = new LinearLayout(cordova.getActivity()); mainLayout.setOrientation(LinearLayout.VERTICAL); inAppWebView = new WebView(cordova.getActivity()); inAppWebView.setLayoutParams(new LinearLayout.LayoutParams(LinearLayout.LayoutParams.MATCH_PARENT, LinearLayout.LayoutParams.MATCH_PARENT)); inAppWebView.setWebChromeClient(new WebChromeClient()); WebViewClient client = new AuthBrowser(); inAppWebView.setWebViewClient(client); WebSettings settings = inAppWebView.getSettings(); settings.setJavaScriptEnabled(true); settings.setJavaScriptCanOpenWindowsAutomatically(true); inAppWebView.loadUrl(authURL + "?client_id=" + slackClientID + "&scope=" + scope); inAppWebView.getSettings().setLoadWithOverviewMode(true); inAppWebView.getSettings().setUseWideViewPort(true); inAppWebView.requestFocus(); inAppWebView.requestFocusFromTouch(); mainLayout.addView(inAppWebView); WindowManager.LayoutParams lp = new WindowManager.LayoutParams(); lp.copyFrom(dialog.getWindow().getAttributes()); lp.width = WindowManager.LayoutParams.MATCH_PARENT; lp.height = WindowManager.LayoutParams.MATCH_PARENT; dialog.setContentView(mainLayout); dialog.show(); dialog.getWindow().setAttributes(lp); } }; this.cordova.getActivity().runOnUiThread(runnable); }
From source file:com.stan.createcustommap.MainActivity.java
private void addMarker() { if (mMap != null) { LinearLayout layout = new LinearLayout(MainActivity.this); layout.setLayoutParams(new ActionBar.LayoutParams(LinearLayout.LayoutParams.MATCH_PARENT, LinearLayout.LayoutParams.WRAP_CONTENT)); layout.setOrientation(LinearLayout.VERTICAL); final EditText titleField = new EditText(MainActivity.this); titleField.setHint("Title"); final EditText latField = new EditText(MainActivity.this); latField.setHint("Latitude"); latField.setInputType(InputType.TYPE_CLASS_NUMBER | InputType.TYPE_NUMBER_FLAG_DECIMAL | InputType.TYPE_NUMBER_FLAG_SIGNED); final EditText longField = new EditText(MainActivity.this); longField.setHint("Longitude"); longField.setInputType(InputType.TYPE_CLASS_NUMBER | InputType.TYPE_NUMBER_FLAG_DECIMAL | InputType.TYPE_NUMBER_FLAG_SIGNED); layout.addView(titleField);//from w w w .ja v a2 s . com layout.addView(latField); layout.addView(longField); AlertDialog.Builder builder = new AlertDialog.Builder(this); builder.setTitle("Add Marker"); builder.setView(layout); AlertDialog alertDialog = builder.create(); builder.setPositiveButton("OK", new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { boolean parsable = true; Double lat = null, lon = null; String strLat = latField.getText().toString(); String strLon = longField.getText().toString(); String strTitle = titleField.getText().toString(); try { lat = Double.parseDouble(strLat); } catch (NumberFormatException ex) { parsable = false; Toast.makeText(MainActivity.this, "Latitude does not contain a parsable double", Toast.LENGTH_LONG).show(); } try { lon = Double.parseDouble(strLon); } catch (NumberFormatException ex) { parsable = false; Toast.makeText(MainActivity.this, "Longitude does not contain a parsable double", Toast.LENGTH_LONG); } if (parsable) { LatLng targetLatLng = new LatLng(lat, lon); MarkerOptions markerOptions = new MarkerOptions().position(targetLatLng).title(strTitle); markerOptions.draggable(true); mMap.addMarker(markerOptions); mMap.moveCamera(CameraUpdateFactory.newLatLng(targetLatLng)); } } }); builder.setNegativeButton("Cancel", null); builder.show(); } else { Toast.makeText(MainActivity.this, "Map not ready", Toast.LENGTH_LONG).show(); } }
From source file:com.tony.selene.sliding.AbSlidingTabView.java
/** * Inits the view.//from w w w. j a v a 2s. com */ public void initView() { this.setOrientation(LinearLayout.VERTICAL); this.setBackgroundColor(Color.rgb(255, 255, 255)); mTabScrollView = new HorizontalScrollView(context); mTabScrollView.setHorizontalScrollBarEnabled(false); mTabScrollView.setSmoothScrollingEnabled(true); mTabLayout = new LinearLayout(context); mTabLayout.setOrientation(LinearLayout.HORIZONTAL); mTabLayout.setGravity(Gravity.CENTER); // mTabLayout mTabScrollView.addView(mTabLayout, new ViewGroup.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.FILL_PARENT)); this.addView(mTabScrollView, new ViewGroup.LayoutParams(ViewGroup.LayoutParams.FILL_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT)); // View? mViewPager = new AbViewPager(context); // ViewPager,setId()id mViewPager.setId(1985); pagerItemList = new ArrayList<Fragment>(); // Tab? tabItemList = new ArrayList<TextView>(); tabItemTextList = new ArrayList<String>(); tabItemDrawableList = new ArrayList<Drawable>(); // ?FragmentActivity if (!(this.context instanceof FragmentActivity)) { AbLogUtil.e(AbSlidingTabView.class, "AbSlidingTabView?context,FragmentActivity"); } }
From source file:org.borderstone.tagtags.TTStartActivity.java
@Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); this.setTheme(R.style.AppTheme); this.setContentView(R.layout.activity_start); Toolbar toolbar = (Toolbar) this.findViewById(R.id.toolbar); //toolbar.inflateMenu(R.menu.menu_start); toolbar.setTitle("TagTags"); toolbar.setVisibility(View.VISIBLE); TTStartActivity.me = getApplicationContext(); protocol.setAction("android.intent.action.PROTOCOL"); settings.setAction("android.intent.action.SETTINGS"); Constants.init(new File(this.getFilesDir(), "bsettings.txt"), this.getApplicationContext()); Constants.fileListener = this; /*Load variables that are stored in a text file keeping version info and info about third party resources here, for easy editing*/ try {// w w w . j a va 2 s.c o m BufferedReader reader = new BufferedReader( new InputStreamReader(this.getResources().openRawResource(R.raw.appinfo))); String line = reader.readLine(); String[] t; while (line != null) { t = line.split(":"); if (line.startsWith("#thirdparty:")) thirdparty += t[1] + "\n"; else if (line.startsWith("#recentchanges:")) recentchanges += "-- " + t[1] + "\n"; line = reader.readLine(); } //just to remove the final new line. if (!thirdparty.equals("")) thirdparty = thirdparty.substring(0, thirdparty.length() - 1); if (!recentchanges.equals("")) recentchanges = recentchanges.substring(0, recentchanges.length() - 1); } catch (Exception ignored) { } //Most of the code below is purely for aesthetics! txtPhilosophy = new BTitleLabel(this); txtPhilosophy.setTypeface(Typeface.DEFAULT_BOLD); txtPhilosophy.setLayoutParams(Constants.defaultParams); txtPhilosophy.setOnClickListener(this); txtPhilosophy.setTextColor(Color.BLACK); txtVersion = new BStandardLabel(this); txtVersion.setText("Recent changes:\n" + recentchanges); txtVersion.setLayoutParams(Constants.defaultParams); txtVersion.setTextColor(Color.BLACK); try { PackageInfo pInfo = getPackageManager().getPackageInfo(getPackageName(), 0); toolbar.setSubtitle("v. " + pInfo.versionName); } catch (PackageManager.NameNotFoundException ignored) { } toolbar.setNavigationIcon(R.drawable.drawer); ImageView slu = new ImageView(this); ImageView sites = new ImageView(this); slu.setImageResource(R.drawable.slulogo); sites.setImageResource(R.drawable.sites); LinearLayout llLogos = new LinearLayout(this); llLogos.setOrientation(LinearLayout.HORIZONTAL); llLogos.setGravity(Gravity.END | Gravity.CENTER_VERTICAL); llLogos.addView(slu); llLogos.addView(sites); setPhiloText(); LinearLayout back = (LinearLayout) this.findViewById(R.id.back); back.setOrientation(LinearLayout.VERTICAL); txtPhilosophy.setLayoutParams(Constants.defaultParams); txtPhilosophy.setBackgroundResource(R.drawable.border); txtVersion.setLayoutParams(Constants.defaultParams); txtVersion.setBackgroundResource(R.drawable.border_recurring); back.addView(txtPhilosophy); back.addView(txtVersion); back.addView(llLogos); lblSettings = new BButton(this); lblDownload = new BButton(this); lblDownload.setIcon(R.drawable.download); lblSettings.setIcon(R.drawable.settings); lblSettings.setText("Settings"); lblDownload.setText("Download from server"); lblSettings.setOnClickListener(this); lblDownload.setOnClickListener(this); if (!checkPermissions()) { final Intent intro = new Intent(); intro.setAction("android.intent.action.INTRO"); this.startActivity(intro); } BTitleLabel lblProperties = new BTitleLabel(this); BTitleLabel lblLocal = new BTitleLabel(this); fileNavView = new BFileNavView(this, this); lblProperties.setTextSize(Constants.fontSize + 2); lblLocal.setTextSize(Constants.fontSize + 2); lblProperties.setText("PROPERTIES"); lblProperties.setTextColor(Color.WHITE); lblProperties.setGravity(Gravity.CENTER); lblLocal.setText("LOCAL FILES"); lblLocal.setTextColor(Color.WHITE); lblLocal.setGravity(Gravity.CENTER); final DrawerLayout drawerLayout = (DrawerLayout) this.findViewById(R.id.startDrawerLayout); final LinearLayout drawer = (LinearLayout) this.findViewById(R.id.drawer); drawer.setClickable(false); drawer.bringToFront(); drawer.addView(lblProperties); drawer.addView(lblDownload); drawer.addView(lblSettings); drawer.addView(lblLocal); drawer.addView(fileNavView); toolbar.setNavigationOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { if (!drawerLayout.isDrawerOpen(Gravity.LEFT)) drawerLayout.openDrawer(Gravity.LEFT); else drawerLayout.closeDrawer(Gravity.LEFT); } }); }
From source file:alexander.martinz.libs.materialpreferences.MaterialPreference.java
public boolean init(Context context, AttributeSet attrs) { if (mInit) {//w w w. j a va2s . c o m return false; } mInit = true; if (attrs != null) { TypedArray typedArray = parseAttrs(context, attrs); recycleTypedArray(typedArray); } final int layoutResId = mPrefAsCard ? R.layout.material_prefs_card_preference : R.layout.material_prefs_preference; mView = getLayoutInflater().inflate(layoutResId, this, true); if (mPrefAsCard) { mCardView = (CardView) mView.findViewById(R.id.card_preference_root); } mIcon = (ImageView) mView.findViewById(android.R.id.icon); mTitle = (TextView) mView.findViewById(android.R.id.title); mSummary = (TextView) mView.findViewById(android.R.id.summary); mWidgetFrame = (LinearLayout) mView.findViewById(android.R.id.widget_frame); mWidgetFrameBottom = (LinearLayout) mView.findViewById(R.id.widget_frame_bottom); if (mResIdIcon != -1 && mIcon != null) { Drawable d = ContextCompat.getDrawable(context, mResIdIcon); if (d != null && mIconTintColor != Integer.MIN_VALUE) { d = d.mutate(); d.setColorFilter(new LightingColorFilter(Color.BLACK, mIconTintColor)); } mIcon.setImageDrawable(d); mIcon.setVisibility(View.VISIBLE); } if (mResIdTitle != -1) { mTitle.setText(mResIdTitle); } if (mResIdSummary != -1 && mSummary != null) { mSummary.setText(mResIdSummary); mSummary.setVisibility(View.VISIBLE); } if (mPrefAsCard && mCardBackgroundColor != Integer.MIN_VALUE) { setBackgroundColor(mCardBackgroundColor); } setSelectable(true); setOnClickListener(this); setOnTouchListener(this); setOrientation(LinearLayout.VERTICAL); return true; }
From source file:org.openremote.android.console.AppSettingsActivity.java
@Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); getWindow().addFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN); setTitle(R.string.settings);/*from www .jav a2s . c o m*/ this.autoMode = AppSettingsModel.isAutoMode(AppSettingsActivity.this); // The main layout contains all application configuration items. LinearLayout mainLayout = new LinearLayout(this); mainLayout .setLayoutParams(new LinearLayout.LayoutParams(LayoutParams.FILL_PARENT, LayoutParams.FILL_PARENT)); mainLayout.setOrientation(LinearLayout.VERTICAL); mainLayout.setBackgroundColor(0); mainLayout.setTag(R.string.settings); loadingPanelProgress = new ProgressDialog(this); // The scroll view contains appSettingsView, and make the appSettingsView can be scrolled. ScrollView scroll = new ScrollView(this); scroll.setVerticalScrollBarEnabled(true); scroll.setLayoutParams( new LinearLayout.LayoutParams(LayoutParams.FILL_PARENT, LayoutParams.WRAP_CONTENT, 1)); appSettingsView = new LinearLayout(this); appSettingsView .setLayoutParams(new LinearLayout.LayoutParams(LayoutParams.FILL_PARENT, LayoutParams.FILL_PARENT)); appSettingsView.setOrientation(LinearLayout.VERTICAL); appSettingsView.addView(createAutoLayout()); appSettingsView.addView(createChooseControllerLabel()); currentServer = ""; if (autoMode) { appSettingsView.addView(constructAutoServersView()); } else { appSettingsView.addView(constructCustomServersView()); } appSettingsView.addView(createChoosePanelLabel()); panelSelectSpinnerView = new PanelSelectSpinnerView(this); appSettingsView.addView(panelSelectSpinnerView); appSettingsView.addView(createCacheText()); appSettingsView.addView(createClearImageCacheButton()); appSettingsView.addView(createSSLLayout()); scroll.addView(appSettingsView); mainLayout.addView(scroll); mainLayout.addView(createDoneAndCancelLayout()); setContentView(mainLayout); initSSLState(); addOnclickListenerOnDoneButton(); addOnclickListenerOnCancelButton(); progressLayout = (LinearLayout) findViewById(R.id.choose_controller_progress); }
From source file:com.blueoxfords.peacecorpstinder.activities.MainActivity.java
public void getLegalInfo(View v) { String photoId = v.getTag() + ""; ImageRestClient.get().getInfoFromImageId(photoId, new Callback<ImageService.ImageInfoWrapper>() { @Override/* w ww . j ava2 s . c om*/ public void success(ImageService.ImageInfoWrapper imageInfoWrapper, Response response) { AlertDialog.Builder builder = new AlertDialog.Builder(MainActivity.activity); ScrollView wrapper = new ScrollView(MainActivity.activity); LinearLayout infoLayout = new LinearLayout(MainActivity.activity); infoLayout.setOrientation(LinearLayout.VERTICAL); infoLayout.setPadding(35, 35, 35, 35); TextView imageOwner = new TextView(MainActivity.activity); imageOwner.setText(Html.fromHtml("<b>Image By: </b>" + imageInfoWrapper.photo.owner.username)); if (imageInfoWrapper.photo.owner.realname.length() > 0) { imageOwner.setText(imageOwner.getText() + " (" + imageInfoWrapper.photo.owner.realname + ")"); } infoLayout.addView(imageOwner); if (getLicenseUrl(Integer.parseInt(imageInfoWrapper.photo.license)).length() > 0) { TextView licenseLink = new TextView(MainActivity.activity); licenseLink.setText(Html .fromHtml("<a href=\"" + getLicenseUrl(Integer.parseInt(imageInfoWrapper.photo.license)) + "\"><b>Licensing</b></a>")); licenseLink.setMovementMethod(LinkMovementMethod.getInstance()); infoLayout.addView(licenseLink); } if (imageInfoWrapper.photo.urls.url.size() > 0) { TextView imageLink = new TextView(MainActivity.activity); imageLink.setText(Html.fromHtml("<a href=\"" + imageInfoWrapper.photo.urls.url.get(0)._content + "\"><b>Image Link</b></a>")); imageLink.setMovementMethod(LinkMovementMethod.getInstance()); infoLayout.addView(imageLink); } if (imageInfoWrapper.photo.title._content.length() > 0) { TextView photoTitle = new TextView(MainActivity.activity); photoTitle .setText(Html.fromHtml("<b>Image Title: </b>" + imageInfoWrapper.photo.title._content)); infoLayout.addView(photoTitle); } if (imageInfoWrapper.photo.description._content.length() > 0) { TextView description = new TextView(MainActivity.activity); description.setText(Html .fromHtml("<b>Image Description: </b>" + imageInfoWrapper.photo.description._content)); infoLayout.addView(description); } TextView contact = new TextView(MainActivity.activity); contact.setText( Html.fromHtml("<br><i>To remove this photo, please email pcorpsconnect@gmail.com</i>")); infoLayout.addView(contact); wrapper.addView(infoLayout); builder.setTitle("Photo Information"); builder.setPositiveButton("Close", new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int id) { } }); builder.setView(wrapper); builder.create().show(); } @Override public void failure(RetrofitError error) { Log.i("testing", "could not retrieve legal/attribution info"); } }); }
From source file:com.ab.view.sliding.AbSlidingTabView_fix.java
/** * Inits the view.//from w w w . ja v a2s . c om */ public void initView() { this.setOrientation(LinearLayout.VERTICAL); this.setBackgroundColor(Color.rgb(255, 255, 255)); mTabScrollView = new HorizontalScrollView(context); mTabScrollView.setHorizontalScrollBarEnabled(false); mTabScrollView.setSmoothScrollingEnabled(true); mTabLayout = new LinearLayout(context); mTabLayout.setOrientation(LinearLayout.HORIZONTAL); mTabLayout.setGravity(Gravity.CENTER); // mTabLayout mTabScrollView.addView(mTabLayout, new ViewGroup.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.FILL_PARENT)); this.addView(mTabScrollView, new ViewGroup.LayoutParams(ViewGroup.LayoutParams.FILL_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT)); // View? mViewPager = new AbViewPager(context); // ViewPager,setId()id mViewPager.setId(1985); pagerItemList = new ArrayList<Fragment>(); // Tab? tabItemList = new ArrayList<TextView>(); tabItemTextList = new ArrayList<String>(); tabItemDrawableList = new ArrayList<Drawable>(); // ?FragmentActivity if (!(this.context instanceof FragmentActivity)) { AbLogUtil.e(AbSlidingTabView_fix.class, "AbSlidingTabView?context,FragmentActivity"); } }
From source file:com.threehalf.tucao.view.pageindicator.TabPageIndicator.java
public TabPageIndicator(Context context, AttributeSet attrs) { super(context, attrs); final Resources res = getResources(); // final int textColor = // res.getres(R.color.default_tab_indicator_text_color); final int tabSelectedColor = res.getColor(R.color.default_tab_indicator_selected_color); final int tabUnSelectedColor = res.getColor(R.color.default_tab_indicator_unselected_color); final float textSize = res.getDimension(R.dimen.default_tab_indicator_textsize); final float paddingLeft = res.getDimension(R.dimen.default_tab_indicator_paddingleft); final float paddingRight = res.getDimension(R.dimen.default_tab_indicator_paddingright); final float paddingTop = res.getDimension(R.dimen.default_tab_indicator_paddingtop); final float paddingBottom = res.getDimension(R.dimen.default_tab_indicator_paddingbottom); final float tabSelectedHeight = res.getDimension(R.dimen.default_tab_indicator_selected_height); final float tabUnSelectedHeight = res.getDimension(R.dimen.default_tab_indicator_unselected_height); TypedArray a = context.obtainStyledAttributes(attrs, R.styleable.TabPageIndicator); mTextColor = a.getResourceId(R.styleable.TabPageIndicator_textColor, R.drawable.selector_tabtextcolor); mTabSelectedColor = a.getColor(R.styleable.TabPageIndicator_selectedColor, tabSelectedColor); mTabUnSelectedColor = a.getColor(R.styleable.TabPageIndicator_unselectedColor, tabUnSelectedColor); mTextSize = a.getDimension(R.styleable.TabPageIndicator_textSize, textSize); mPaddingLeft = a.getDimension(R.styleable.TabPageIndicator_paddingLeft, paddingLeft); mPaddingRight = a.getDimension(R.styleable.TabPageIndicator_paddingRight, paddingRight); mPaddingTop = a.getDimension(R.styleable.TabPageIndicator_paddingTop, paddingTop); mPaddingBottom = a.getDimension(R.styleable.TabPageIndicator_paddingBottom, paddingBottom); mTabSelectedHeight = a.getDimension(R.styleable.TabPageIndicator_selectedHeight, tabSelectedHeight); mTabUnSelectedHeight = a.getDimension(R.styleable.TabPageIndicator_unSelectedHeight, tabUnSelectedHeight); setHorizontalScrollBarEnabled(false); mTabAndIndicator = new LinearLayout(context); mTabAndIndicator.setOrientation(LinearLayout.VERTICAL); mTabLayout = new LinearLayout(context); mTabAndIndicator.addView(mTabLayout, new LinearLayout.LayoutParams(WRAP_CONTENT, 0, 1)); mSlideLineIndicator = new SlideLineIndicator(context); mTabAndIndicator.addView(mSlideLineIndicator, new LinearLayout.LayoutParams(MATCH_PARENT, (int) mTabSelectedHeight, 0)); addView(mTabAndIndicator, new ViewGroup.LayoutParams(WRAP_CONTENT, MATCH_PARENT)); a.recycle();/*from w ww. ja v a 2 s .c o m*/ }