Java Code Examples for android.widget.LinearLayout.getLayoutParams()

The following are Jave code examples for showing how to use getLayoutParams() of the android.widget.LinearLayout class. You can vote up the examples you like. Your votes will be used in our system to get more good examples.
+ Save this method
Example 1
Project: androidtools   File: ToastUtils.java   View Source Code Vote up 6 votes
public static void showCenterToast(Context context, String title, @DrawableRes int drawableId, int duration) {
    Toast toast = makeText(context.getApplicationContext(), title, duration);
    toast.setGravity(Gravity.CENTER, 0, 0);
    View view = LayoutInflater.from(context).inflate(R.layout.layout_center_toast, null);
    LinearLayout rlContent = (LinearLayout) view.findViewById(R.id.rl_content);
    TextView content = (TextView) view.findViewById(R.id.tv_content);
    ImageView alertIcon = (ImageView) view.findViewById(R.id.iv_icon);
    if (drawableId != 0) {
        alertIcon.setVisibility(View.VISIBLE);
        alertIcon.setImageResource(drawableId);
    } else {
        alertIcon.setVisibility(View.GONE);
    }
    if (!TextUtils.isEmpty(title)) {
        content.setText(title);
    }
    WindowManager wm = (WindowManager) context.getSystemService(Context.WINDOW_SERVICE);
    int screenWidth = wm.getDefaultDisplay().getWidth();
    int width = (int) (screenWidth / 2f);
    FrameLayout.LayoutParams lp = (FrameLayout.LayoutParams) rlContent.getLayoutParams();
    lp.width = width;
    rlContent.setLayoutParams(lp);
    rlContent.requestLayout();
    toast.setView(view);
    toast.show();
}
 
Example 2
Project: YCDialog   File: ToastUtil.java   View Source Code Vote up 6 votes
public static void showStart(Context context , int viewId) {
    if (context == null) {
        return;
    }
    final Toast toast = Toast.makeText(context, "", Toast.LENGTH_SHORT);
    View view ;
    if(viewId==0){
        view = LayoutInflater.from(context).inflate(R.layout.view_layout_toast_load,null,false);
    }else {
        view = LayoutInflater.from(context).inflate(viewId,null,false);
    }
    LinearLayout ll_toast = (LinearLayout) view.findViewById(R.id.toast);
    //布局文件中设置的宽高不顶用,需要重新设置;注意:不能设置最外层控件的宽高,会报空指针,可以设置第二层控件的宽高
    Activity activity = (Activity) context;
    WindowManager windowManager = activity.getWindowManager();
    Display display = windowManager.getDefaultDisplay();
    int screenWidth = display.getWidth();
    int screenHeight = display.getHeight();
    ll_toast.getLayoutParams().width = (int) (screenWidth*0.411);
    ll_toast.getLayoutParams().height = (int) (screenHeight*0.18);

    //设置吐司居中显示
    toast.setGravity(Gravity.CENTER, 0, 0);
    toast.setView(view);
    toast.show();
}
 
Example 3
Project: YCDialog   File: ToastUtil.java   View Source Code Vote up 6 votes
public static void showDelete(Context context, int viewId) {
    if (context == null) {
        return;
    }
    final Toast toast = Toast.makeText(context, "", Toast.LENGTH_SHORT);
    View view ;
    if(viewId==0){
        view = LayoutInflater.from(context).inflate(R.layout.view_layout_toast_delete,null,false);
    }else {
        view = LayoutInflater.from(context).inflate(viewId,null,false);
    }
    LinearLayout ll_toast = (LinearLayout) view.findViewById(R.id.toast);
    //布局文件中设置的宽高不顶用,需要重新设置;注意:不能设置最外层控件的宽高,会报空指针,可以设置第二层控件的宽高
    Activity activity = (Activity) context;
    WindowManager windowManager = activity.getWindowManager();
    Display display = windowManager.getDefaultDisplay();
    int screenWidth = display.getWidth();
    int screenHeight = display.getHeight();
    ll_toast.getLayoutParams().width = (int) (screenWidth*0.411);
    ll_toast.getLayoutParams().height = (int) (screenHeight*0.18);
    //设置吐司居中显示
    toast.setGravity(Gravity.CENTER, 0, 0);
    toast.setView(view);
    toast.show();
}
 
Example 4
Project: Mybilibili   File: MySearchView.java   View Source Code Vote up 6 votes
/**
 * 绑定搜索框xml视图
 */
private void initView() {
    // 1. 绑定R.layout.search_layout作为搜索框的xml文件
    LayoutInflater.from(mContext).inflate(R.layout.search_layout,this);
    et_search = (EditText) findViewById(R.id.et_search);
    et_search.setTextSize(textSizeSearch);
    et_search.setTextColor(textColorSearch);
    et_search.setHint(textHintSearch);

    // 3. 搜索框背景颜色
    search_block = (LinearLayout) findViewById(R.id.search_linear);
    LinearLayout.LayoutParams params = (LinearLayout.LayoutParams) search_block.getLayoutParams();
    params.height = searchBlockHeight;
    search_block.setBackgroundColor(searchBlockColor);
    search_block.setLayoutParams(params);

    // 4. 历史搜索记录 = ListView显示
    listView = (SearchListView) findViewById(R.id.listView);

    // 5. 删除历史搜索记录 按钮
    tv_clear = (TextView) findViewById(R.id.tv_clear);
    tv_clear.setVisibility(INVISIBLE);

    // 6. 返回按键
    searchBack = (ImageView) findViewById(R.id.search_icon);
}
 
Example 5
Project: CameraKitView   File: CameraActivity.java   View Source Code Vote up 6 votes
@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setFullScreen();
    setContentView(R.layout.activity_camera);
    Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
    toolbar.setTitleTextColor(Color.WHITE);
    toolbar.setTitle(R.string.app_name);
    setSupportActionBar(toolbar);
    mCameraView = (CameraView) findViewById(R.id.camera_view);

    mRecordButton = (Button) findViewById(R.id.video);
    mRecordButton.setOnClickListener(this);
    mPictureButton = (Button) findViewById(R.id.picture);
    mPictureButton.setOnClickListener(this);

    int height = getResources().getDisplayMetrics().heightPixels / 4;
    LinearLayout controlLayout = (LinearLayout) findViewById(R.id.control);
    RelativeLayout.LayoutParams layoutParams = (RelativeLayout.LayoutParams) controlLayout.getLayoutParams();
    layoutParams.height = height;
    controlLayout.setLayoutParams(layoutParams);
}
 
Example 6
Project: Pocket-Plays-for-Twitch   File: StreamerInfoFragment.java   View Source Code Vote up 6 votes
public void initColorandLayout(int color, int colorLight, int textColor, boolean inLandScape) {
    StreamerInfoName.setTextColor(textColor);
    StreamerInfoName.setBackgroundColor(colorLight);

    if(inLandScape){
        Log.v(LOG_TAG, "Is in landscape - Fragment");
        //StreamerInfoName.getLayoutParams().width = (int) (((getResources().getDisplayMetrics().widthPixels)/100) * StreamerInfoActivity.landscape_content_width - (context.getResources().getDimension(R.dimen.fragment_streamerInfo_cardElevation) * 2));
    } else {
        ContentLayout.setMaxCardElevation(0);
        ContentLayout.setCardElevation(0);
        int screenWidth = (getResources().getDisplayMetrics().widthPixels);
        LinearLayout llContainer = (LinearLayout) rootView.findViewById(R.id.fragment_streamerInfo_container_layout);

        int newWidth = (int)(screenWidth + getResources().getDimension(R.dimen.fragment_streamerInfo_cardElevation));
        llContainer.getLayoutParams().width = newWidth;

        float newTranslationX = (float)((newWidth - screenWidth) * -0.5);
        llContainer.setTranslationX(newTranslationX);
        llContainer.setGravity(Gravity.CENTER_HORIZONTAL);

    }
}
 
Example 7
Project: SuperNote   File: RvNoteListAdapter.java   View Source Code Vote up 6 votes
/**
 * 显示是否线性布局时的分组信息
 *
 * @param helper
 * @param isShow 是否显示
 * @param time   时间戳
 * @describe
 */
private void showLineraLayoutGroup(boolean isShow, BaseViewHolder helper, long time) {
    // 有分组的列,marginTop为8dp,否则,为0dp
    LinearLayout ll = helper.getView(R.id.ll_note_list_linear);
    LinearLayout.LayoutParams params = (LinearLayout.LayoutParams) ll.getLayoutParams();
    if (isShow) {
        helper.setVisible(R.id.tv_note_list_linear_month, true);
        setLinearGroupStyle(helper, time);

        params.setMargins(SizeUtils.dp2px(0), SizeUtils.dp2px(8), SizeUtils.dp2px(0), SizeUtils.dp2px(0));
        ll.setLayoutParams(params);

    } else {
        helper.setVisible(R.id.tv_note_list_linear_month, false);
        params.setMargins(SizeUtils.dp2px(0), SizeUtils.dp2px(0), SizeUtils.dp2px(0), SizeUtils.dp2px(0));
        ll.setLayoutParams(params);
    }
}
 
Example 8
Project: GitHub   File: TranslucentActivity.java   View Source Code Vote up 5 votes
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.translucent_layout);
    tv=(TextView)this.findViewById(R.id.tv);
    int mode=getIntent().getIntExtra("mode",0);
    Log.d(TAG,"MODE:"+mode);
    //当系统版本为4.4或者4.4以上时可以使用沉浸式状态栏
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
        //透明状态栏
        getWindow().addFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS);
        //透明导航栏
        getWindow().addFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_NAVIGATION);
        if (mode == 0) {
             LinearLayout linear_bar=(LinearLayout)findViewById(R.id.linear_bar);
             linear_bar.setVisibility(View.VISIBLE);
             int statusHeight=getStatusBarHeight();
             android.widget.LinearLayout.LayoutParams params=(android.widget.LinearLayout.LayoutParams )linear_bar.getLayoutParams();
             params.height=statusHeight;
             linear_bar.setLayoutParams(params);
             tv.setText("系统方法沉浸式实现");
        } else if (mode == 1) {
            // create our manager instance after the content view is set
            SystemBarTintManager tintManager = new SystemBarTintManager(this);
            // 激活状态栏
            tintManager.setStatusBarTintEnabled(true);
            // enable navigation bar tint 激活导航栏
            tintManager.setNavigationBarTintEnabled(true);
            //设置系统栏设置颜色
            //tintManager.setTintColor(R.color.red);
            //给状态栏设置颜色
            tintManager.setStatusBarTintResource(R.color.middle_red);
            // 设置导航栏设置资源
            tintManager.setNavigationBarTintResource(R.color.color_nav);
            tv.setText("第三方库沉浸式实现");
        }
    }
}
 
Example 9
Project: Nird2   File: LargeTextInputView.java   View Source Code Vote up 5 votes
@Override
protected void setUpViews(Context context, @Nullable AttributeSet attrs) {
	super.setUpViews(context, attrs);

	// get attributes
	TypedArray attributes = context.obtainStyledAttributes(attrs,
			R.styleable.LargeTextInputView);
	String buttonText =
			attributes.getString(R.styleable.LargeTextInputView_buttonText);
	int maxLines =
			attributes
					.getInteger(R.styleable.LargeTextInputView_maxLines, 0);
	boolean fillHeight = attributes
			.getBoolean(R.styleable.LargeTextInputView_fillHeight,
					false);
	attributes.recycle();

	if (buttonText != null) setButtonText(buttonText);
	if (maxLines > 0) ui.editText.setMaxLines(maxLines);
	if (fillHeight) {
		LinearLayout layout =
				(LinearLayout) findViewById(R.id.input_layout);
		LayoutParams params = (LayoutParams) layout.getLayoutParams();
		params.height = 0;
		params.weight = 1;
		layout.setLayoutParams(params);
		ViewGroup.LayoutParams editParams = ui.editText.getLayoutParams();
		editParams.height = MATCH_PARENT;
		ui.editText.setLayoutParams(editParams);
	}
}
 
Example 10
Project: Nird2   File: LargeTextInputView.java   View Source Code Vote up 5 votes
@Override
protected void setUpViews(Context context, @Nullable AttributeSet attrs) {
	super.setUpViews(context, attrs);

	// get attributes
	TypedArray attributes = context.obtainStyledAttributes(attrs,
			R.styleable.LargeTextInputView);
	String buttonText =
			attributes.getString(R.styleable.LargeTextInputView_buttonText);
	int maxLines =
			attributes
					.getInteger(R.styleable.LargeTextInputView_maxLines, 0);
	boolean fillHeight = attributes
			.getBoolean(R.styleable.LargeTextInputView_fillHeight,
					false);
	attributes.recycle();

	if (buttonText != null) setButtonText(buttonText);
	if (maxLines > 0) ui.editText.setMaxLines(maxLines);
	if (fillHeight) {
		LinearLayout layout =
				(LinearLayout) findViewById(R.id.input_layout);
		LayoutParams params = (LayoutParams) layout.getLayoutParams();
		params.height = 0;
		params.weight = 1;
		layout.setLayoutParams(params);
		ViewGroup.LayoutParams editParams = ui.editText.getLayoutParams();
		editParams.height = MATCH_PARENT;
		ui.editText.setLayoutParams(editParams);
	}
}
 
Example 11
Project: CameraKitView   File: MainActivity.java   View Source Code Vote up 5 votes
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setFullScreen();
    setContentView(R.layout.activity_main);
    Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
    toolbar.setTitleTextColor(Color.WHITE);
    toolbar.setTitle(R.string.app_name);
    setSupportActionBar(toolbar);
    if (null == savedInstanceState) {
        mCamera2Fragment = Camera2Fragment.newInstance();
        getFragmentManager().beginTransaction()
            .replace(R.id.container, mCamera2Fragment)
            .commit();
    } else {
        mCamera2Fragment = (Camera2Fragment) getFragmentManager().findFragmentById(R.id.container);
    }

    mRecordButton = (Button) findViewById(R.id.video);
    mRecordButton.setOnClickListener(this);
    mPictureButton = (Button) findViewById(R.id.picture);
    mPictureButton.setOnClickListener(this);

    int height = getResources().getDisplayMetrics().heightPixels / 4;
    LinearLayout controlLayout = (LinearLayout) findViewById(R.id.control);
    RelativeLayout.LayoutParams layoutParams = (RelativeLayout.LayoutParams) controlLayout.getLayoutParams();
    layoutParams.height = height;
    controlLayout.setLayoutParams(layoutParams);
}
 
Example 12
Project: youtube_background_android   File: SearchFragment.java   View Source Code Vote up 5 votes
private void resizeVideoContainer(View v, int height) {
    LinearLayout videosContainer = (LinearLayout) v.findViewById(R.id.videos_container);
    FrameLayout.LayoutParams params = (FrameLayout.LayoutParams) videosContainer.getLayoutParams();
    float density = context.getResources().getDisplayMetrics().density;
    params.topMargin = (int) (6 * density);
    params.height = height;
    videosContainer.setLayoutParams(params);
}
 
Example 13
Project: BestPracticeApp   File: DialogActivity.java   View Source Code Vote up 5 votes
public void createDialog() {
    setContentView(R.layout.dialog_bottom);
    show();
    Window window = getWindow();
    LinearLayout ll_content = (LinearLayout) window.findViewById(R.id.ll_content);
    window.setLayout(ViewGroup.LayoutParams.MATCH_PARENT,ViewGroup.LayoutParams.MATCH_PARENT);
    FrameLayout.LayoutParams layoutParams = (FrameLayout.LayoutParams) ll_content.getLayoutParams();
    layoutParams.gravity = Gravity.BOTTOM;
    ll_content.setLayoutParams(layoutParams);


}
 
Example 14
Project: emerald   File: Dock.java   View Source Code Vote up 5 votes
public Dock(Context context) {
	contextRef = new SoftReference<Context>(context);
	dockBar = (LinearLayout) ((Apps)context).findViewById(R.id.dock_bar);
	defaultHeight = dockBar.getLayoutParams().height;
	apps = new ArrayList<AppData>();
	buttons = new ArrayList<ImageView>();
	buttons.add((ImageView)((Apps)context).findViewById(R.id.button1));
	buttons.add((ImageView)((Apps)context).findViewById(R.id.button2));
	buttons.add((ImageView)((Apps)context).findViewById(R.id.button3));
	buttons.add((ImageView)((Apps)context).findViewById(R.id.button4));
	buttons.add((ImageView)((Apps)context).findViewById(R.id.button5));
	//update();
}
 
Example 15
Project: SearchLayout   File: FlowSearchLayout.java   View Source Code Vote up 4 votes
private void initSearchView() {
    SearchView searchView = mBinding.svSearch;
    //设置搜索框左边距
    LinearLayout editFrame = (LinearLayout) findViewById(R.id.search_edit_frame);
    LinearLayout.LayoutParams editP = (LayoutParams) editFrame.getLayoutParams();
    editP.leftMargin = 0;
    editP.rightMargin = 0;
    ImageView imageView = (ImageView) findViewById(R.id.search_mag_icon);
    imageView.setAdjustViewBounds(true);
    imageView.setLayoutParams(new LinearLayout.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT));
    LinearLayout.LayoutParams lp3 = (LayoutParams) imageView.getLayoutParams();
    lp3.gravity = Gravity.CENTER_VERTICAL;
    lp3.leftMargin = (int) (DensityUtil.dip2px(8f) * DensityUtil.getBaseScale(getContext()));
    lp3.rightMargin = (int) (DensityUtil.dip2px(-2f) * DensityUtil.getBaseScale(getContext()));

    View view = searchView.findViewById(R.id.search_plate);
    view.setBackgroundColor(getResources().getColor(R.color.colorTransparent));
    EditText editText = (EditText) searchView.findViewById(R.id.search_src_text);
    editText.setBackgroundColor(Color.TRANSPARENT);
    editText.setTextSize(11.5f);
    editText.setTextColor(getResources().getColor(R.color.colorText));
    editText.setHintTextColor(getResources().getColor(R.color.colorHint));
    try {
        Field fCursorDrawableRes = TextView.class.getDeclaredField("mCursorDrawableRes");
        fCursorDrawableRes.setAccessible(true);
        int mCursorDrawableRes = fCursorDrawableRes.getInt(editText);
        Field fEditor = TextView.class.getDeclaredField("mEditor");
        fEditor.setAccessible(true);
        Object editor = fEditor.get(editText);
        Class<?> clazz = editor.getClass();
        Field fCursorDrawable = clazz.getDeclaredField("mCursorDrawable");
        fCursorDrawable.setAccessible(true);
        if (mCursorDrawableRes <= 0) return;
        Drawable cursorDrawable = ContextCompat.getDrawable(searchView.getContext(), mCursorDrawableRes);
        if (cursorDrawable == null) return;
        Drawable tintDrawable = DrawableCompat.wrap(cursorDrawable);
        DrawableCompat.setTintList(tintDrawable, ColorStateList.valueOf(ContextCompat.getColor(getContext(), R.color.bg_search)));
        Drawable[] drawables = new Drawable[]{tintDrawable, tintDrawable};
        fCursorDrawable.set(editor, drawables);
    } catch (Throwable t) {
        t.printStackTrace();
    }
}
 
Example 16
Project: SearchLayout   File: FlexSearchLayout.java   View Source Code Vote up 4 votes
private void initSearchView() {
    SearchView searchView = mBinding.svSearch;
    //设置搜索框左边距
    LinearLayout editFrame = (LinearLayout) findViewById(R.id.search_edit_frame);
    LinearLayout.LayoutParams editP = (LayoutParams) editFrame.getLayoutParams();
    editP.leftMargin = 0;
    editP.rightMargin = 0;
    ImageView imageView = (ImageView) findViewById(R.id.search_mag_icon);
    imageView.setAdjustViewBounds(true);
    imageView.setLayoutParams(new LinearLayout.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT));
    LinearLayout.LayoutParams lp3 = (LayoutParams) imageView.getLayoutParams();
    lp3.gravity = Gravity.CENTER_VERTICAL;
    lp3.leftMargin = (int) (DensityUtil.dip2px(8f) * DensityUtil.getBaseScale(getContext()));
    lp3.rightMargin = (int) (DensityUtil.dip2px(-2f) * DensityUtil.getBaseScale(getContext()));

    View view = searchView.findViewById(R.id.search_plate);
    view.setBackgroundColor(getResources().getColor(R.color.colorTransparent));
    EditText editText = (EditText) searchView.findViewById(R.id.search_src_text);
    editText.setBackgroundColor(Color.TRANSPARENT);
    editText.setTextSize(11.5f);
    editText.setTextColor(getResources().getColor(R.color.colorText));
    editText.setHintTextColor(getResources().getColor(R.color.colorHint));
    try {
        Field fCursorDrawableRes = TextView.class.getDeclaredField("mCursorDrawableRes");
        fCursorDrawableRes.setAccessible(true);
        int mCursorDrawableRes = fCursorDrawableRes.getInt(editText);
        Field fEditor = TextView.class.getDeclaredField("mEditor");
        fEditor.setAccessible(true);
        Object editor = fEditor.get(editText);
        Class<?> clazz = editor.getClass();
        Field fCursorDrawable = clazz.getDeclaredField("mCursorDrawable");
        fCursorDrawable.setAccessible(true);
        if (mCursorDrawableRes <= 0) return;
        Drawable cursorDrawable = ContextCompat.getDrawable(searchView.getContext(), mCursorDrawableRes);
        if (cursorDrawable == null) return;
        Drawable tintDrawable = DrawableCompat.wrap(cursorDrawable);
        DrawableCompat.setTintList(tintDrawable, ColorStateList.valueOf(ContextCompat.getColor(getContext(), R.color.bg_search)));
        Drawable[] drawables = new Drawable[]{tintDrawable, tintDrawable};
        fCursorDrawable.set(editor, drawables);
    } catch (Throwable t) {
        t.printStackTrace();
    }
}
 
Example 17
Project: SWDemo   File: ChatActivity.java   View Source Code Vote up 4 votes
@Override
protected void initUIandEvent() {
    event().addEventHandler(this);

    Intent i = getIntent();

    String channelName = i.getStringExtra(ConstantApp.ACTION_KEY_CHANNEL_NAME);

    final String encryptionKey = getIntent().getStringExtra(ConstantApp.ACTION_KEY_ENCRYPTION_KEY);

    final String encryptionMode = getIntent().getStringExtra(ConstantApp.ACTION_KEY_ENCRYPTION_MODE);

    doConfigEngine(encryptionKey, encryptionMode);

    mGridVideoViewContainer = (GridVideoViewContainer) findViewById(R.id.grid_video_view_container);
    mGridVideoViewContainer.setItemEventHandler(new VideoViewEventListener() {
        @Override
        public void onItemDoubleClick(View v, Object item) {
            log.debug("onItemDoubleClick " + v + " " + item + " " + mLayoutType);

            if (mUidsList.size() < 2) {
                return;
            }

            UserStatusData user = (UserStatusData) item;
            int uid = (user.mUid == 0) ? config().mUid : user.mUid;

            if (mLayoutType == LAYOUT_TYPE_DEFAULT && mUidsList.size() != 1) {
                switchToSmallVideoView(uid);
            } else {
                switchToDefaultVideoView();
            }
        }
    });

    SurfaceView surfaceV = RtcEngine.CreateRendererView(getApplicationContext());
    rtcEngine().setupLocalVideo(new VideoCanvas(surfaceV, VideoCanvas.RENDER_MODE_HIDDEN, 0));
    surfaceV.setZOrderOnTop(false);
    surfaceV.setZOrderMediaOverlay(false);

    mUidsList.put(0, surfaceV); // get first surface view

    mGridVideoViewContainer.initViewContainer(getApplicationContext(), 0, mUidsList); // first is now full view
    worker().preview(true, surfaceV, 0);
    config().mUid = AGApplication.uid;
    String channelKey = AGApplication.channelKey;
    worker().joinChannel(channelName, config().mUid,channelKey);

    TextView textChannelName = (TextView) findViewById(R.id.channel_name);
    textChannelName.setText(channelName);

    optional();

    LinearLayout bottomContainer = (LinearLayout) findViewById(R.id.bottom_container);
    FrameLayout.MarginLayoutParams fmp = (FrameLayout.MarginLayoutParams) bottomContainer.getLayoutParams();
    fmp.bottomMargin = virtualKeyHeight() + 16;

    initMessageList();
}
 
Example 18
Project: AOSP-Kayboard-7.1.2   File: EmojiLayoutParams.java   View Source Code Vote up 4 votes
public void setActionBarProperties(final LinearLayout ll) {
    final LinearLayout.LayoutParams lp = (LinearLayout.LayoutParams) ll.getLayoutParams();
    lp.height = getActionBarHeight();
    ll.setLayoutParams(lp);
}
 
Example 19
Project: OpenVideoCall-Android   File: ChatActivity.java   View Source Code Vote up 4 votes
@Override
protected void initUIandEvent() {
    event().addEventHandler(this);

    Intent i = getIntent();

    String channelName = i.getStringExtra(ConstantApp.ACTION_KEY_CHANNEL_NAME);

    final String encryptionKey = getIntent().getStringExtra(ConstantApp.ACTION_KEY_ENCRYPTION_KEY);
    final String encryptionMode = getIntent().getStringExtra(ConstantApp.ACTION_KEY_ENCRYPTION_MODE);

    doConfigEngine(encryptionKey, encryptionMode);

    mGridVideoViewContainer = (GridVideoViewContainer) findViewById(R.id.grid_video_view_container);
    mGridVideoViewContainer.setItemEventHandler(new VideoViewEventListener() {
        @Override
        public void onItemDoubleClick(View v, Object item) {
            log.debug("onItemDoubleClick " + v + " " + item + " " + mLayoutType);

            if (mUidsList.size() < 2) {
                return;
            }

            UserStatusData user = (UserStatusData) item;
            int uid = (user.mUid == 0) ? config().mUid : user.mUid;

            if (mLayoutType == LAYOUT_TYPE_DEFAULT && mUidsList.size() != 1) {
                switchToSmallVideoView(uid);
            } else {
                switchToDefaultVideoView();
            }
        }
    });

    SurfaceView surfaceV = RtcEngine.CreateRendererView(getApplicationContext());
    rtcEngine().setupLocalVideo(new VideoCanvas(surfaceV, VideoCanvas.RENDER_MODE_HIDDEN, 0));
    surfaceV.setZOrderOnTop(false);
    surfaceV.setZOrderMediaOverlay(false);

    mUidsList.put(0, surfaceV); // get first surface view

    mGridVideoViewContainer.initViewContainer(this, 0, mUidsList, mIsLandscape); // first is now full view
    worker().preview(true, surfaceV, 0);

    worker().joinChannel(channelName, config().mUid);

    TextView textChannelName = (TextView) findViewById(R.id.channel_name);
    textChannelName.setText(channelName);

    optional();

    LinearLayout bottomContainer = (LinearLayout) findViewById(R.id.bottom_container);
    FrameLayout.MarginLayoutParams fmp = (FrameLayout.MarginLayoutParams) bottomContainer.getLayoutParams();
    fmp.bottomMargin = virtualKeyHeight() + 16;

    initMessageList();
}
 
Example 20
Project: Android_watch_magpie   File: FragmentHome.java   View Source Code Vote up 4 votes
private void ajustArea(LinearLayout area, float weight)
{
    LinearLayout.LayoutParams param =new LinearLayout.LayoutParams(area.getLayoutParams());
    param.weight=weight;
    area.setLayoutParams(param);
}