因此,我有一个作为对话框(Theme.Dialog)启动的活动。我用它来播放视频,调暗背景,看起来很酷......但它总是集中在屏幕上,不知道如何以编程方式将其移动到底部。如何将ViewGroup与屏幕底部对齐
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/lr_layout"
android:background="#FF000000"
android:padding="0dp" >
<RelativeLayout
android:id="@+id/lr_progressContainer"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#FF000000">
<ProgressBar android:id="@+id/lr_progress"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerInParent="true"
android:background="@android:color/black"
style="@android:style/Widget.ProgressBar.Large" />
<View android:id="@+id/disableShape"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:padding="0dp"
android:visibility="gone"
android:background="#CC000000"
/>
</RelativeLayout>
</RelativeLayout>
然后我以编程方式添加视频播放器(从第三方查看)。
我已经试过这样:
layout = (ViewGroup) findViewById(R.id.lr_layout);
layout.setY(0);
这:
RelativeLayout.LayoutParams adViewLayoutParams = new RelativeLayout.LayoutParams(RelativeLayout.LayoutParams.MATCH_PARENT, RelativeLayout.LayoutParams.MATCH_PARENT);
adViewLayoutParams.addRule(RelativeLayout.ALIGN_BOTTOM);
layout.addView(adView, adViewLayoutParams);
但视频仍然在该中心。
有什么想法?
谢谢!
工程就像一个魅力。感谢西蒙! – vanderflo 2014-09-19 21:11:36