gpt4 book ai didi

android - 如何设置android :orientation ="horizontal" programmatically in RelativeLayout?

转载 作者:塔克拉玛干 更新时间:2023-11-02 20:20:30 25 4
gpt4 key购买 nike

如何在 RelativeLayout 中像这样以编程方式设置 android:orientation="horizo​​ntal":

<RelativeLayout
android:id="@+id/ID"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal" >

</RelativeLayout>

这是我目前所拥有的:

RelativeLayout rLayout = new RelativeLayout(getActivity());
LayoutParams layoutParams;
layoutParams = new LinearLayout.LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT);
rLayout.setLayoutParams(layoutParams);

最佳答案

正如您在 the docs 中看到的那样, RelativeLayout 没有 orientation 参数。

关于android - 如何设置android :orientation ="horizontal" programmatically in RelativeLayout?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/20458542/

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