如何在 RelativeLayout 中像这样以编程方式设置 android:orientation="horizontal":
<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/