这是我的主要活动xml文件。
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:padding="5dp"
android:background="#ffffff" >
<TextView
android:id="@+id/txtPostMessage"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="3dp"
android:textColor="#000000"
/>
<FrameLayout
android:id="@+id/postItems"
android:layout_width="match_parent"
android:layout_height="wrap_content"
>
</FrameLayout>
<TextView
android:id="@+id/txtPostCreatedTime"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="right"
android:textColor="@android:color/black"
/>
<ListView
android:id="@+id/lvCommentList"
android:layout_width="match_parent"
android:layout_height="wrap_content"
>
</ListView>
</LinearLayout>
我在framelayout中动态添加xml布局,除了包含videoView的布局外,一切都很好。
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical" >
<VideoView
android:id="@+id/postVideo"
android:layout_width="match_parent"
android:layout_height="wrap_content"
/>
</LinearLayout>
我正在通过这样的inflater添加我的这些布局。
View v = inflater.inflate(R.layout.videoview_activity, null, false);
PostVideo = (VideoView) v.findViewById(R.id.postVideo);
Uri vidUri = Uri.parse(source);
PostVideo.setVideoURI(vidUri);
PostItems.addView(v);
其他布局工作正常但在此布局上,videoView正在播放具有非常暗/暗对比度的视频。
My activity is dialogue activity, so it opens on top of my previous activity, And sometimes it shows previous activity through framelayout, which may mean that framelayout or video layout is transparent