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: 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 #2
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 #3
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 #4
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 #5
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 #6
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 #7
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 #8
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 #9
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 #10
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 #11
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 #12
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 #13
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 #14
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 #15
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 #16
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 #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: 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 #19
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 #20
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 #21
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 #22
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 #23
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 #24
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 #25
Source File: NotificationPeekActivity.java From NotificationPeekPort with Apache License 2.0 | 5 votes |
/** * Update small notification icons when there is new notification coming, and the * Activity is in foreground. */ private void updateNotificationIcons() { if (mNotificationsContainer.getVisibility() != View.VISIBLE) { mNotificationsContainer.setVisibility(View.VISIBLE); } NotificationHub notificationHub = NotificationHub.getInstance(); int iconSize = getResources().getDimensionPixelSize(R.dimen.small_notification_icon_size); int padding = getResources().getDimensionPixelSize(R.dimen.small_notification_icon_padding); final StatusBarNotification n = notificationHub.getCurrentNotification(); ImageView icon = new ImageView(this); icon.setAlpha(NotificationPeek.ICON_LOW_OPACITY); icon.setPadding(padding, 0, padding, 0); icon.setImageDrawable(NotificationPeekViewUtils.getIconFromResource(this, n)); icon.setTag(n); restoreFirstIconVisibility(); int oldIndex = getOldIconViewIndex(notificationHub); if (oldIndex >= 0) { mNotificationsContainer.removeViewAt(oldIndex); } mNotificationsContainer.addView(icon); LinearLayout.LayoutParams linearLayoutParams = new LinearLayout.LayoutParams(iconSize, iconSize); // Wrap LayoutParams to GridLayout.LayoutParams. GridLayout.LayoutParams gridLayoutParams = new GridLayout.LayoutParams(linearLayoutParams); icon.setLayoutParams(gridLayoutParams); }
Example #26
Source File: BrickRecyclerAdapterTest.java From brickkit-android with Apache License 2.0 | 5 votes |
@Test public void testOnCreateViewHolder() { BaseBrick brick = mock(BaseBrick.class); when(brick.getLayout()).thenReturn(R.layout.text_brick); when(dataManager.brickWithLayout(anyInt())).thenReturn(brick); adapter.onCreateViewHolder(new LinearLayout(InstrumentationRegistry.getTargetContext()), brick.getLayout()); verify(brick).createViewHolder(any(View.class)); }
Example #27
Source File: LayoutHelper.java From KrGallery with GNU General Public License v2.0 | 5 votes |
public static LinearLayout.LayoutParams createLinear(int width, int height, float weight, int gravity) { LinearLayout.LayoutParams layoutParams = new LinearLayout.LayoutParams(getSize(width), getSize(height), weight); layoutParams.gravity = gravity; return layoutParams; }
Example #28
Source File: MyMessageTabPageIndicator.java From letv with Apache License 2.0 | 5 votes |
public void setCurrentItem(int item) { if (this.mViewPager != null) { if (!(item == -1 || this.mSelectedTabIndex == item)) { this.mViewPager.setCurrentItem(item); } this.mSelectedTabIndex = item; int tabCount = this.mTabLayout.getChildCount(); int i = 0; while (i < tabCount) { LinearLayout childLayout = (LinearLayout) this.mTabLayout.getChildAt(i); for (int j = 0; j < childLayout.getChildCount(); j++) { boolean isSelected = i == item; View view = childLayout.getChildAt(j); if (view instanceof TabView) { view.setSelected(isSelected); if (isSelected) { animateToTab(item); ((TabView) view).setTextColor(this.mContext.getResources().getColor(2131493202)); } else { ((TabView) view).setTextColor(this.mContext.getResources().getColor(2131493237)); } } else if (isSelected) { view.setBackgroundColor(this.mContext.getResources().getColor(2131493202)); } else { view.setBackgroundDrawable(null); } } i++; } } }
Example #29
Source File: ActionMenuElement.java From gravitydefied with GNU General Public License v2.0 | 5 votes |
@Override protected void createAllViews() { super.createAllViews(); Context context = getGDActivity(); lockImage = new MenuImageView(context); lockImage.setScaleType(ImageView.ScaleType.CENTER); lockImage.setVisibility(View.GONE); LinearLayout.LayoutParams lp = new LinearLayout.LayoutParams(LinearLayout.LayoutParams.WRAP_CONTENT, LinearLayout.LayoutParams.MATCH_PARENT); lp.setMargins(0, 0, getDp(ActionMenuElement.LOCK_IMAGE_MARGIN_RIGHT), 0); lockImage.setLayoutParams(lp); layout.addView(lockImage, 1); }
Example #30
Source File: SearchGroupMember.java From XERUNG with Apache License 2.0 | 5 votes |
private void findViewIds(){ mLayback = (RelativeLayout)findViewById(R.id.layBack); listview = (ListView)findViewById(R.id.lvList); relProgress = (RelativeLayout)findViewById(R.id.layProgressresult); layMain = (LinearLayout)findViewById(R.id.layMain); edtSearch = (EditText)findViewById(R.id.edtGroupSearch); txtType = (TextView)findViewById(R.id.txtTypeSearch); txtType.setTypeface(ManagerTypeface.getTypeface(SearchGroupMember.this, R.string.typeface_roboto_regular)); }