gpt4 book ai didi

android - 如何将填充或边距设置为线性布局?

转载 作者:塔克拉玛干 更新时间:2023-11-02 21:51:38 24 4
gpt4 key购买 nike

我有一个线性布局

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/layout_menu"
android:layout_width="fill_parent"
android:layout_height="70px"
android:layout_alignParentBottom="true"
android:background="@drawable/footer_bar"
android:gravity="center" >
</LinearLayout>

当我设置条件时

if (constant.getscreenresolution() >= 800) {
//i want to make it height * 2
}

那么如何设置布局参数呢?

最佳答案

对于填充:

LinearLayout mLayout = (LinearLayout)findViewById(R.id.layout_menu);
mLayout.setPadding(left, top, right, bottom);

关于android - 如何将填充或边距设置为线性布局?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10779115/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com