android.widget.LinearLayout Java Examples
The following examples show how to use
android.widget.LinearLayout.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: StatusBarUtil.java From TLint with Apache License 2.0 | 6 votes |
/** * 为 DrawerLayout 布局设置状态栏透明 * * @param activity 需要设置的activity * @param drawerLayout DrawerLayout */ public static void setTransparentForDrawerLayout(Activity activity, DrawerLayout drawerLayout) { if (Build.VERSION.SDK_INT < Build.VERSION_CODES.KITKAT) { return; } if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { activity.getWindow().addFlags(WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS); activity.getWindow().clearFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS); activity.getWindow().setStatusBarColor(Color.TRANSPARENT); } else { activity.getWindow().addFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS); } ViewGroup contentLayout = (ViewGroup) drawerLayout.getChildAt(0); // 内容布局不是 LinearLayout 时,设置padding top if (!(contentLayout instanceof LinearLayout) && contentLayout.getChildAt(1) != null) { contentLayout.getChildAt(1).setPadding(0, getStatusBarHeight(activity), 0, 0); } // 设置属性 ViewGroup drawer = (ViewGroup) drawerLayout.getChildAt(1); drawerLayout.setFitsSystemWindows(false); contentLayout.setFitsSystemWindows(false); contentLayout.setClipToPadding(true); drawer.setFitsSystemWindows(false); }
Example #2
Source File: AdvancedShortcutActivity.java From TvAppRepo with Apache License 2.0 | 6 votes |
@Override public void onIcons(PackedIcon[] icons) { if (getResources().getBoolean(R.bool.ENABLE_ICON_PACKS)) { Log.d(TAG, icons.length + "<<<"); // Show all icons for the user to select (or let them do their own) LinearLayout iconDialogLayout = (LinearLayout) findViewById(R.id.icon_list); iconDialogLayout.requestFocus(); iconDialogLayout.removeAllViews(); for (final PackedIcon icon : icons) { ImageButton imageButton = new ImageButton(AdvancedShortcutActivity.this); imageButton.setImageDrawable(icon.icon); imageButton.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { if (icon.isBanner) { advancedOptions.setBannerBitmap(icon.getBitmap()); } else { advancedOptions.setIconBitmap(icon.getBitmap()); } Log.d(TAG, advancedOptions.toString()); } }); iconDialogLayout.addView(imageButton); } } }
Example #3
Source File: DialogPaletteSettings.java From microMathematics with GNU General Public License v3.0 | 6 votes |
private void prepareGroup(Context context, LinearLayout itemLayout, String s, List<String> visibleGroups) { final AppCompatCheckBox cb = itemLayout.findViewById(R.id.dialog_palette_settings_checkbox); cb.setTag(s); cb.setChecked(visibleGroups.contains(s)); final LinearLayout buttonLayout = itemLayout.findViewById(R.id.dialog_palette_settings_buttons); for (int i = 0; i < buttonLayout.getChildCount(); i++) { if (buttonLayout.getChildAt(i) instanceof AppCompatImageButton) { final AppCompatImageButton b = (AppCompatImageButton) buttonLayout.getChildAt(i); b.setOnLongClickListener(this); ViewUtils.setImageButtonColorAttr(context, b, R.attr.colorDialogContent); } } }
Example #4
Source File: QsDetailItemsList.java From GravityBox with Apache License 2.0 | 6 votes |
private QsDetailItemsList(LinearLayout view) { mView = view; mListView = (ListView) mView.findViewById(android.R.id.list); mListView.setOnTouchListener(new OnTouchListener() { // Setting on Touch Listener for handling the touch inside ScrollView @Override public boolean onTouch(View v, MotionEvent event) { // Disallow the touch request for parent scroll on touch of child view v.getParent().requestDisallowInterceptTouchEvent(true); return false; } }); mEmpty = mView.findViewById(android.R.id.empty); mEmpty.setVisibility(View.GONE); mEmptyText = (TextView) mEmpty.findViewById(android.R.id.title); mEmptyIcon = (ImageView) mEmpty.findViewById(android.R.id.icon); mListView.setEmptyView(mEmpty); }
Example #5
Source File: HomeActivity.java From EasyVPN-Free with GNU General Public License v3.0 | 6 votes |
private void initMap() { AndroidGraphicFactory.createInstance(getApplication()); mapView = new MapView(this); mapView.setClickable(true); mapView.getMapScaleBar().setVisible(false); mapView.setBuiltInZoomControls(false); mapView.setZoomLevelMin((byte) 2); mapView.setZoomLevelMax((byte) 10); mapView.setZoomLevel((byte) 2); mapView.getModel().displayModel.setBackgroundColor(ContextCompat.getColor(this, R.color.mapBackground)); layers = mapView.getLayerManager().getLayers(); MapCreator mapCreator = new MapCreator(this, layers); mapCreator.parseGeoJson("world_map.geo.json"); initServerOnMap(layers); LinearLayout map = (LinearLayout) findViewById(R.id.map); map.addView(mapView); }
Example #6
Source File: AppDialog.java From Android_framework with BSD 2-Clause "Simplified" License | 6 votes |
private LinearLayout generateLayout(String text){ LinearLayout layout = (LinearLayout) inflater.inflate(R.layout.dialog_item_button_layout, null); View v_line = layout.findViewById(R.id.v_line); TextView tv_text = (TextView) layout.findViewById(R.id.tv_text); tv_text.setText(text); if (ll_bottom_button.getChildCount() == 0){ layout.removeView(v_line); tv_text.setBackgroundResource(R.drawable.dialog_button_bottom_selector); } else if (ll_bottom_button.getChildCount() == 1){ tv_text.setBackgroundResource(R.drawable.dialog_button_bottomright_selector); } else{ tv_text.setBackgroundResource(R.drawable.dialog_button_bottomright_selector); } reBuildCircle(); LinearLayout.LayoutParams params = new LinearLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT); params.weight = 1; layout.setLayoutParams(params); layout.setOnClickListener(this); return layout; }
Example #7
Source File: MainActivity.java From AndroidVideoSamples with Apache License 2.0 | 6 votes |
@Override public void onCreate( Bundle savedInstanceState ) { super.onCreate( savedInstanceState ); setContentView( R.layout.activity_main ); mSelectedVideoLayout = (LinearLayout) findViewById( R.id.selected_video_layout ); mVideoThumbnail = (ImageView) findViewById( R.id.selected_video_thumbnail ); mVideoName = (TextView) findViewById( R.id.selected_video_name ); SharedPreferences settings = getPreferences( Context.MODE_PRIVATE ); String video = settings.getString( RECENT_VIDEO_KEY, null ); if ( video != null ) { loadUri( Uri.parse( video ) ); } }
Example #8
Source File: AppInvCaptureActivity.java From appinventor-extensions with Apache License 2.0 | 6 votes |
@Override public void onCreate(Bundle icicle) { super.onCreate(icicle); Window window = getWindow(); window.addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON); viewLayout = new LinearLayout(this); viewLayout.setOrientation(LinearLayout.HORIZONTAL); frameLayout = new FrameLayout(this); frameLayout.addView(viewLayout, new ViewGroup.LayoutParams(ViewGroup.LayoutParams.FILL_PARENT, ViewGroup.LayoutParams.FILL_PARENT)); frameLayout.setBackgroundColor(0xFFFFFFFF); // COLOR_WHITE XXX setContentView(frameLayout); frameLayout.requestLayout(); hasSurface = false; }
Example #9
Source File: AlertController.java From PreferenceFragment with Apache License 2.0 | 6 votes |
private void setupContent(LinearLayout contentPanel) { mScrollView = (ScrollView) mWindow.findViewById(R.id.scrollView); mScrollView.setFocusable(false); // Special case for users that only want to display a String mMessageView = (TextView) mWindow.findViewById(R.id.message); if (mMessageView == null) { return; } if (mMessage != null) { mMessageView.setText(mMessage); } else { mMessageView.setVisibility(View.GONE); mScrollView.removeView(mMessageView); if (mListView != null) { contentPanel.removeView(mWindow.findViewById(R.id.scrollView)); contentPanel.addView(mListView, new LinearLayout.LayoutParams(MATCH_PARENT, MATCH_PARENT)); contentPanel.setLayoutParams(new LinearLayout.LayoutParams(MATCH_PARENT, 0, 1.0f)); } else { contentPanel.setVisibility(View.GONE); } } }
Example #10
Source File: RxBaseRoundProgressBar.java From RxTools-master with Apache License 2.0 | 6 votes |
private void setupReverse(LinearLayout layoutProgress) { RelativeLayout.LayoutParams progressParams = (RelativeLayout.LayoutParams) layoutProgress.getLayoutParams(); removeLayoutParamsRule(progressParams); if (isReverse) { progressParams.addRule(RelativeLayout.ALIGN_PARENT_RIGHT); // For support with RTL on API 17 or more if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR1) progressParams.addRule(RelativeLayout.ALIGN_PARENT_END); } else { progressParams.addRule(RelativeLayout.ALIGN_PARENT_LEFT); // For support with RTL on API 17 or more if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR1) progressParams.addRule(RelativeLayout.ALIGN_PARENT_START); } layoutProgress.setLayoutParams(progressParams); }
Example #11
Source File: GosChooseDeviceWorkWiFiActivity.java From GOpenSource_AppKit_Android_AS with MIT License | 6 votes |
private void initView() { etSSID = (EditText) findViewById(R.id.etSSID); etPsw = (EditText) findViewById(R.id.etPsw); llNext = (LinearLayout) findViewById(R.id.llNext); cbLaws = (CheckBox) findViewById(R.id.cbLaws); imgWiFiList = (ImageView) findViewById(R.id.imgWiFiList); if (!TextUtils.isEmpty(workSSID)) { etSSID.setText(workSSID); if (checkworkSSIDUsed(workSSID)) { if (!TextUtils.isEmpty(spf.getString("workSSIDPsw", ""))) { etPsw.setText(spf.getString("workSSIDPsw", "")); } } } }
Example #12
Source File: NickSignActivity.java From o2oa with GNU Affero General Public License v3.0 | 6 votes |
private void initView() { mEd_sign = (EditText) findViewById(R.id.ed_sign); mLl_nickSign = (LinearLayout) findViewById(R.id.ll_nickSign); mTv_count = (TextView) findViewById(R.id.tv_count); mJmui_commit_btn = (Button) findViewById(R.id.jmui_commit_btn); if (getIntent().getStringExtra("group_name") != null) { mEd_sign.setText(getIntent().getStringExtra("group_name")); } if (getIntent().getStringExtra("group_desc") != null) { mEd_sign.setText(getIntent().getStringExtra("group_desc")); } if (getIntent().getStringExtra("old_nick") != null) { mEd_sign.setText(getIntent().getStringExtra("old_nick")); } if (getIntent().getStringExtra("old_sign") != null) { mEd_sign.setText(getIntent().getStringExtra("old_sign")); } mEd_sign.setSelection(mEd_sign.getText().length()); }
Example #13
Source File: A6OrderAty.java From Huochexing12306 with Apache License 2.0 | 6 votes |
private void initViews() { mNavigationIndex = getIntent() .getIntExtra(EXTRA_PRE_LOAD_DATA_INDEX, 0); llytOperate = (LinearLayout) findViewById(R.id.operate); btnCancel = (Button) findViewById(R.id.cancel); btnCancel.setOnClickListener(this); btnPay = (Button) findViewById(R.id.pay); btnPay.setOnClickListener(this); tvEmptyView = (TextView) findViewById(R.id.emptyView); lvOrders = (ExpandableListView) findViewById(R.id.orders); lvOrders.setEmptyView(tvEmptyView); LayoutInflater inflater = (LayoutInflater) getSystemService(LAYOUT_INFLATER_SERVICE); View footerView = inflater.inflate(R.layout.fv_a6_order, null); lvOrders.addFooterView(footerView); mAdapter = new A6OrderExpandableAdapter(this, mLstODBInfos); lvOrders.setAdapter(mAdapter); // btnPay.setEnabled(false); setPanelGone(true); }
Example #14
Source File: DialogPreferenceBackgroundColor.java From Simple-Solitaire with GNU General Public License v3.0 | 6 votes |
@Override protected void onBindDialogView(View view) { backgroundType = prefs.getSavedBackgroundColorType(); backgroundValue = prefs.getSavedBackgroundColor(); savedCustomColor = prefs.getSavedBackgroundCustomColor(); linearLayouts = new ArrayList<>(); linearLayouts.add(view.findViewById(R.id.dialogBackgroundColorBlue)); linearLayouts.add(view.findViewById(R.id.dialogBackgroundColorGreen)); linearLayouts.add(view.findViewById(R.id.dialogBackgroundColorRed)); linearLayouts.add(view.findViewById(R.id.dialogBackgroundColorYellow)); linearLayouts.add(view.findViewById(R.id.dialogBackgroundColorOrange)); linearLayouts.add(view.findViewById(R.id.dialogBackgroundColorPurple)); for (LinearLayout linearLayout : linearLayouts) { linearLayout.setOnClickListener(this); } super.onBindDialogView(view); }
Example #15
Source File: EditPage.java From AndroidLinkup with GNU General Public License v2.0 | 6 votes |
private LinearLayout getPageBody() { llBody = new LinearLayout(getContext()); llBody.setId(2); int resId = getBitmapRes(activity, "edittext_back"); if (resId > 0) { llBody.setBackgroundResource(resId); } llBody.setOrientation(LinearLayout.VERTICAL); RelativeLayout.LayoutParams lpBody = new RelativeLayout.LayoutParams( LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT); lpBody.addRule(RelativeLayout.ALIGN_LEFT, llTitle.getId()); lpBody.addRule(RelativeLayout.BELOW, llTitle.getId()); lpBody.addRule(RelativeLayout.ALIGN_RIGHT, llTitle.getId()); if (!dialogMode) { lpBody.addRule(RelativeLayout.ALIGN_PARENT_BOTTOM); } int dp_3 = dipToPx(getContext(), 3); lpBody.setMargins(dp_3, dp_3, dp_3, dp_3); llBody.setLayoutParams(lpBody); llBody.addView(getMainBody()); llBody.addView(getSep()); llBody.addView(getPlatformList()); return llBody; }
Example #16
Source File: BrowserActivity.java From Xndroid with GNU General Public License v3.0 | 6 votes |
private void initializeToolbarHeight(@NonNull final Configuration configuration) { // TODO externalize the dimensions doOnLayout(mUiLayout, new Runnable() { @Override public void run() { int toolbarSize; if (configuration.orientation == Configuration.ORIENTATION_PORTRAIT) { // In portrait toolbar should be 56 dp tall toolbarSize = Utils.dpToPx(56); } else { // In landscape toolbar should be 48 dp tall toolbarSize = Utils.dpToPx(52); } mToolbar.setLayoutParams(new LinearLayout.LayoutParams(LayoutParams.MATCH_PARENT, toolbarSize)); mToolbar.setMinimumHeight(toolbarSize); doOnLayout(mToolbar, new Runnable() { @Override public void run() { setWebViewTranslation(mToolbarLayout.getHeight()); } }); mToolbar.requestLayout(); } }); }
Example #17
Source File: ImageActivity.java From MiBandDecompiled with Apache License 2.0 | 6 votes |
private void b(String s1, int i1) { Toast toast = Toast.makeText(this, s1, 1); LinearLayout linearlayout = (LinearLayout)toast.getView(); ((TextView)linearlayout.getChildAt(0)).setPadding(8, 0, 0, 0); ImageView imageview = new ImageView(this); imageview.setLayoutParams(new android.widget.LinearLayout.LayoutParams(com.tencent.connect.avatar.c.a(this, 16F), com.tencent.connect.avatar.c.a(this, 16F))); if (i1 == 0) { imageview.setImageDrawable(b("com.tencent.plus.ic_success.png")); } else { imageview.setImageDrawable(b("com.tencent.plus.ic_error.png")); } linearlayout.addView(imageview, 0); linearlayout.setOrientation(0); linearlayout.setGravity(17); toast.setView(linearlayout); toast.setGravity(17, 0, 0); toast.show(); }
Example #18
Source File: ExportActivity.java From geopaparazzi with GNU General Public License v3.0 | 6 votes |
protected void addMenuEntries(List<IMenuEntry> entries) { menuEntriesMap.clear(); int code = START_REQUEST_CODE + 1; for (final eu.geopaparazzi.library.plugin.types.IMenuEntry entry : entries) { final Context context = this; Button button = new Button(context); LinearLayout.LayoutParams lp = StyleHelper.styleButton(this, button); button.setText(entry.getLabel()); entry.setRequestCode(code); menuEntriesMap.put(code, entry); code++; LinearLayout container = findViewById(R.id.scrollView); container.addView(button, lp); button.setOnClickListener(new Button.OnClickListener() { public void onClick(View v) { entry.onClick(ExportActivity.this); } }); } }
Example #19
Source File: FilterSortDialog.java From narrate-android with Apache License 2.0 | 6 votes |
private void updateDateText(Dialog dialog) { mDateStartText.setText(mStartDate == null ? getString(R.string.start) : mFormatter.format(mStartDate.getTime())); mDateEndText.setText(mEndDate == null ? getString(R.string.end) : mFormatter.format(mEndDate.getTime())); final LinearLayout filterDateLayout = (LinearLayout) dialog.findViewById(R.id.filter_date_layout); final RelativeLayout.LayoutParams lp = (RelativeLayout.LayoutParams) filterDateLayout.getLayoutParams(); if (mStartDate != null && mEndDate != null) { lp.addRule(RelativeLayout.BELOW, R.id.filter_date); lp.addRule(RelativeLayout.RIGHT_OF, 0); lp.leftMargin = Math.round(getActivity().getResources().getDimensionPixelOffset(R.dimen.checkbox_text_offset)); } else { lp.addRule(RelativeLayout.BELOW, 0); lp.addRule(RelativeLayout.RIGHT_OF, R.id.filter_date); lp.leftMargin = 0; } filterDateLayout.setLayoutParams(lp); }
Example #20
Source File: MainActivity.java From AndroidKeyboard with GNU General Public License v3.0 | 6 votes |
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); LinearLayout enableSetting = findViewById(R.id.layout_EnableSetting); LinearLayout addKeyboards = findViewById(R.id.layout_AddLanguages); LinearLayout chooseInputMethod = findViewById(R.id.layout_ChooseInput); LinearLayout chooseTheme = findViewById(R.id.layout_ChooseTheme); LinearLayout manageDictionaries = findViewById(R.id.layout_ManageDictionary); LinearLayout about = findViewById(R.id.layout_about); enableSetting.setOnClickListener(this); addKeyboards.setOnClickListener(this); chooseInputMethod.setOnClickListener(this); chooseTheme.setOnClickListener(this); manageDictionaries.setOnClickListener(this); about.setOnClickListener(this); AdView adView = this.findViewById(R.id.adView); AdRequest adRequest = new AdRequest.Builder() .addTestDevice(AdRequest.DEVICE_ID_EMULATOR) .addTestDevice("D17FE6D8441E3F2375E3709A2EED851B") .build(); adView.loadAd(adRequest); }
Example #21
Source File: Preferences.java From Cirrus_depricated with GNU General Public License v2.0 | 6 votes |
@Override protected void onPostCreate(Bundle savedInstanceState) { super.onPostCreate(savedInstanceState); getDelegate().onPostCreate(savedInstanceState); LinearLayout root = (LinearLayout)findViewById(android.R.id.list).getParent().getParent().getParent(); Toolbar toolbar = (Toolbar) LayoutInflater.from(this).inflate(R.layout.toolbar, root, false); root.addView(toolbar, 0); // insert at top setSupportActionBar(toolbar); getSupportActionBar().setDisplayHomeAsUpEnabled(true); getSupportActionBar().setTitle(R.string.actionbar_settings); toolbar.setNavigationOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { finish(); } }); }
Example #22
Source File: EditViewInMZActivity.java From AndroidAll with Apache License 2.0 | 6 votes |
@Override protected void onCreate(@Nullable Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_edit_view_mz); LinearLayout ll = (LinearLayout) findViewById(R.id.ll_container); MZEditText myEditText = new MZEditText(this); myEditText.setExtraWidth(11); //myEditText.removeExtraWidth(); myEditText.setBackgroundResource(0); myEditText.setInputType(InputType.TYPE_NUMBER_FLAG_DECIMAL | InputType.TYPE_CLASS_NUMBER); myEditText.setMaxLines(1); myEditText.setSingleLine(true); ll.addView(myEditText, 1); }
Example #23
Source File: StatusBarUtil.java From FileManager with Apache License 2.0 | 6 votes |
/** * 为DrawerLayout 布局设置状态栏变色(5.0以下无半透明效果,不建议使用) * * @param activity 需要设置的activity * @param drawerLayout DrawerLayout * @param color 状态栏颜色值 */ public static void setColorForDrawerLayoutDiff(Activity activity, DrawerLayout drawerLayout, int color) { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) { activity.getWindow().addFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS); // 生成一个状态栏大小的矩形 View statusBarView = createStatusBarView(activity, color); // 添加 statusBarView 到布局中 ViewGroup contentLayout = (ViewGroup) drawerLayout.getChildAt(0); contentLayout.addView(statusBarView, 0); // 内容布局不是 LinearLayout 时,设置padding top if (!(contentLayout instanceof LinearLayout) && contentLayout.getChildAt(1) != null) { contentLayout.getChildAt(1).setPadding(0, getStatusBarHeight(activity), 0, 0); } // 设置属性 ViewGroup drawer = (ViewGroup) drawerLayout.getChildAt(1); drawerLayout.setFitsSystemWindows(false); contentLayout.setFitsSystemWindows(false); contentLayout.setClipToPadding(true); drawer.setFitsSystemWindows(false); } }
Example #24
Source File: PullToRefreshAdapterViewBase.java From AndroidBase with Apache License 2.0 | 5 votes |
private static FrameLayout.LayoutParams convertEmptyViewLayoutParams(ViewGroup.LayoutParams lp) { FrameLayout.LayoutParams newLp = null; if (null != lp) { newLp = new FrameLayout.LayoutParams(lp); if (lp instanceof LinearLayout.LayoutParams) { newLp.gravity = ((LinearLayout.LayoutParams) lp).gravity; } else { newLp.gravity = Gravity.CENTER; } } return newLp; }
Example #25
Source File: KJSlidingMenu.java From KJFrameForAndroid with Apache License 2.0 | 5 votes |
@Override protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) { if (!once) { LinearLayout wrapper = (LinearLayout) getChildAt(0);// 获取到根布局 mMenu = (ViewGroup) wrapper.getChildAt(0); mContent = (ViewGroup) wrapper.getChildAt(1); mMenuWidth = mScreenWidth - mMenuRightPadding; mHalfMenuWidth = mMenuWidth / 3; mMenu.getLayoutParams().width = mMenuWidth; mContent.getLayoutParams().width = mScreenWidth; } super.onMeasure(widthMeasureSpec, heightMeasureSpec); }
Example #26
Source File: LiteSyllabusView.java From LiteSyllabusView with Apache License 2.0 | 5 votes |
private void setupWeekdayHeader() { layoutWeekdayHeader = new LinearLayout(mContext); layoutWeekdayHeader.setOrientation(HORIZONTAL); ViewGroup.LayoutParams params = new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, mWeekdayHeaderHeight); layoutWeekdayHeader.setLayoutParams(params); TextView tvEmptyCellOnTopAndLeft = new TextView(mContext); tvEmptyCellOnTopAndLeft.setWidth(mSectionSidebarWidth); tvEmptyCellOnTopAndLeft.setHeight(mWeekdayHeaderHeight); tvEmptyCellOnTopAndLeft.setText("\\"); tvEmptyCellOnTopAndLeft.setTextSize(WEEKDAY_TITLE_TEXT_SIZE); tvEmptyCellOnTopAndLeft.setTextColor(ContextCompat.getColor(mContext, R.color.textTitle)); tvEmptyCellOnTopAndLeft.setGravity(Gravity.CENTER); tvEmptyCellOnTopAndLeft.setTypeface(mTitleTypeface); layoutWeekdayHeader.addView(tvEmptyCellOnTopAndLeft); for (int i = 0; i < mWeekdayNumber; ++i) { layoutWeekdayHeader.addView(getVerticalDividerView()); TextView tvWeekdayTitle = new TextView(mContext); tvWeekdayTitle.setWidth(mSectionWidth); tvWeekdayTitle.setHeight(mWeekdayHeaderHeight); tvWeekdayTitle.setText(WEEKDAY_TITLES[i]); tvWeekdayTitle.setTextSize(WEEKDAY_TITLE_TEXT_SIZE); tvWeekdayTitle.setTextColor(ContextCompat.getColor(mContext, R.color.textTitle)); tvWeekdayTitle.setGravity(Gravity.CENTER); tvWeekdayTitle.setTypeface(mTitleTypeface); layoutWeekdayHeader.addView(tvWeekdayTitle); } layoutWeekdayHeader.setBackgroundColor(ContextCompat.getColor(mContext, R.color.bgWeekdayHeader)); }
Example #27
Source File: EaseEmojiconScrollTabBar.java From nono-android with GNU General Public License v3.0 | 5 votes |
private void init(Context context, AttributeSet attrs){ this.context = context; LayoutInflater.from(context).inflate(R.layout.ease_widget_emojicon_tab_bar, this); scrollView = (HorizontalScrollView) findViewById(R.id.scroll_view); tabContainer = (LinearLayout) findViewById(R.id.tab_container); }
Example #28
Source File: WeatherChartView.java From FakeWeather with Apache License 2.0 | 5 votes |
public WeatherChartView(Context context, AttributeSet attrs, int defStyleAttr) { super(context, attrs, defStyleAttr); this.setOrientation(VERTICAL); transition.enableTransitionType(LayoutTransition.APPEARING); this.setLayoutTransition(transition); rowParams = new LinearLayout.LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT); cellParams = new LinearLayout.LayoutParams(0, LayoutParams.WRAP_CONTENT, 1); chartParams = new LinearLayout.LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT); }
Example #29
Source File: MainActivity.java From AutoEx with Apache License 2.0 | 5 votes |
@Override protected void onCreate(Bundle savedInstanceState) { // AutoEx.apply(getApplication()); 更加推荐把AutoEx放在Application中初始化 super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); LinearLayout mainView = (LinearLayout) findViewById(R.id.activity_main); }
Example #30
Source File: CallsRecyclerViewAdapter.java From BaldPhone with Apache License 2.0 | 5 votes |
public ViewHolder(View itemView) { super(itemView); container = (LinearLayout) itemView; ll_contact_only = container.findViewById(R.id.ll_contact_only); profile_pic = container.findViewById(R.id.profile_pic); tv_type = container.findViewById(R.id.tv_call_type); iv_type = container.findViewById(R.id.iv_call_type); contact_name = container.findViewById(R.id.contact_name); tv_time = container.findViewById(R.id.tv_time); image_letter = container.findViewById(R.id.image_letter); line = container.findViewById(R.id.line); day = container.findViewById(R.id.day); fl_contact_only = container.findViewById(R.id.fl_contact_only); ll_contact_only.setOnClickListener(this); }