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 Project: RxTools-master   Author: duboAndroid   File: RxBaseRoundProgressBar.java    License: Apache License 2.0 6 votes vote down vote up
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 Project: appinventor-extensions   Author: mit-cml   File: AppInvCaptureActivity.java    License: Apache License 2.0 6 votes vote down vote up
@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 Project: AndroidVideoSamples   Author: hoolrory   File: MainActivity.java    License: Apache License 2.0 6 votes vote down vote up
@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 Project: TvAppRepo   Author: ITVlab   File: AdvancedShortcutActivity.java    License: Apache License 2.0 6 votes vote down vote up
@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 Project: PreferenceFragment   Author: kongnanlive   File: AlertController.java    License: Apache License 2.0 6 votes vote down vote up
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 Project: microMathematics   Author: mkulesh   File: DialogPaletteSettings.java    License: GNU General Public License v3.0 6 votes vote down vote up
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 Project: Huochexing12306   Author: SShineTeam   File: A6OrderAty.java    License: Apache License 2.0 6 votes vote down vote up
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 Project: o2oa   Author: o2oa   File: NickSignActivity.java    License: GNU Affero General Public License v3.0 6 votes vote down vote up
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 Project: Simple-Solitaire   Author: TobiasBielefeld   File: DialogPreferenceBackgroundColor.java    License: GNU General Public License v3.0 6 votes vote down vote up
@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 Project: AndroidLinkup   Author: csuyzb   File: EditPage.java    License: GNU General Public License v2.0 6 votes vote down vote up
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 Project: geopaparazzi   Author: geopaparazzi   File: ExportActivity.java    License: GNU General Public License v3.0 6 votes vote down vote up
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 Project: narrate-android   Author: timothymiko   File: FilterSortDialog.java    License: Apache License 2.0 6 votes vote down vote up
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 Project: AndroidKeyboard   Author: maihannijat   File: MainActivity.java    License: GNU General Public License v3.0 6 votes vote down vote up
@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 Project: FileManager   Author: RuijiePan   File: StatusBarUtil.java    License: Apache License 2.0 6 votes vote down vote up
/**
 * 为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 Project: AndroidAll   Author: chiclaim   File: EditViewInMZActivity.java    License: Apache License 2.0 6 votes vote down vote up
@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 Project: Cirrus_depricated   Author: skymania   File: Preferences.java    License: GNU General Public License v2.0 6 votes vote down vote up
@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 Project: MiBandDecompiled   Author: vishnudevk   File: ImageActivity.java    License: Apache License 2.0 6 votes vote down vote up
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 Project: Xndroid   Author: XndroidDev   File: BrowserActivity.java    License: GNU General Public License v3.0 6 votes vote down vote up
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 Project: Android_framework   Author: zhaozepeng   File: AppDialog.java    License: BSD 2-Clause "Simplified" License 6 votes vote down vote up
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 Project: GravityBox   Author: WrBug   File: QsDetailItemsList.java    License: Apache License 2.0 6 votes vote down vote up
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 Project: GOpenSource_AppKit_Android_AS   Author: gizwits   File: GosChooseDeviceWorkWiFiActivity.java    License: MIT License 6 votes vote down vote up
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 Project: EasyVPN-Free   Author: MaxSmile   File: HomeActivity.java    License: GNU General Public License v3.0 6 votes vote down vote up
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 Project: TLint   Author: gzsll   File: StatusBarUtil.java    License: Apache License 2.0 6 votes vote down vote up
/**
 * 为 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 Project: nono-android   Author: tianyuan168326   File: EaseEmojiconScrollTabBar.java    License: GNU General Public License v3.0 5 votes vote down vote up
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 Project: NotificationPeekPort   Author: lzanita09   File: NotificationPeekActivity.java    License: Apache License 2.0 5 votes vote down vote up
/**
 * 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 Project: brickkit-android   Author: wayfair   File: BrickRecyclerAdapterTest.java    License: Apache License 2.0 5 votes vote down vote up
@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 Project: KrGallery   Author: chengzichen   File: LayoutHelper.java    License: GNU General Public License v2.0 5 votes vote down vote up
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 Project: letv   Author: JackChan1999   File: MyMessageTabPageIndicator.java    License: Apache License 2.0 5 votes vote down vote up
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 Project: gravitydefied   Author: evgenyzinoviev   File: ActionMenuElement.java    License: GNU General Public License v2.0 5 votes vote down vote up
@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 Project: XERUNG   Author: mityung   File: SearchGroupMember.java    License: Apache License 2.0 5 votes vote down vote up
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));
}