2015-01-12 4 views
0

안녕하세요 내 기기에서 애플리케이션을 실행하는 동안 내 XML 레이아웃에 비디오 뷰가 표시되지 않는 문제가 있습니다. 가능한 사람이 나에게xml 레이아웃에 VideoView가 표시되지 않습니다.

XML

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" 
    xmlns:tools="http://schemas.android.com/tools" 
    android:layout_width="match_parent" 
    android:layout_height="match_parent" 
    android:background="@drawable/ballbackground" 
    android:paddingBottom="@dimen/activity_vertical_margin" 
    android:paddingLeft="@dimen/activity_horizontal_margin" 
    android:paddingRight="@dimen/activity_horizontal_margin" 
    android:paddingTop="@dimen/activity_vertical_margin" 
    tools:context="com.example.buttondemo.FootballBalls" > 



<TextView 
    android:id="@+id/textView1" 
    android:layout_width="wrap_content" 
    android:layout_height="wrap_content" 
    android:layout_alignParentLeft="true" 
    android:layout_alignParentTop="true" 
    android:layout_marginLeft="22dp" 
    android:layout_marginTop="18dp" 
    android:text="@string/btnRules" /> 

<ScrollView 
    android:id="@+id/scrollView1" 
    android:layout_width="wrap_content" 
    android:layout_height="wrap_content" 
    android:layout_alignLeft="@+id/textView1" 
    android:layout_below="@+id/textView1" 
    android:layout_marginTop="10dp" > 

    <LinearLayout 
     android:layout_width="match_parent" 
     android:layout_height="match_parent" 
     android:orientation="vertical" > 

     <Gallery 
      android:id="@+id/worldcupball" 
      android:layout_width="227dp" 
      android:layout_height="143dp" 
      android:background="@drawable/worldcupball" 
      android:textAlignment="center" /> 

     <TextView 
      android:id="@+id/mainActivityHeader" 
      android:layout_width="228dp" 
      android:layout_height="131dp" 
      android:text="@string/ball_explanation" /> 

     <TextView 
      android:id="@+id/textView3" 
      android:layout_width="wrap_content" 
      android:layout_height="wrap_content" 
      android:text="@string/ball_construction" 
      android:layout_marginTop="20dp"/> 


     <Gallery 
      android:id="@+id/gallery1" 
      android:layout_width="wrap_content" 
      android:layout_height="138dp" 
      android:background="@drawable/roteirotechdrawing" 
      android:layout_marginLeft="20dp" /> 

     <VideoView 
      android:id="@+id/OutfitView" 
      android:layout_width="match_parent" 
      android:layout_height="wrap_content" 
      android:layout_gravity="center_horizontal" 
      android:visibility="visible"/> 

    </LinearLayout> 
</ScrollView> 

권한

<uses-permission android:name="android.permission.INTERNET" /> 
     <uses-permission android:name="android.permission.WAKE_LOCK" /> 
     <uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" /> 
도와주세요 그래서 만약 내가 자바 클래스가 올바른지 확신으로 나는 단지 XML을 붙여 넣기하고, 난 그냥이 알아낼 수 없습니다
+0

가능한가? – JoxTraex

+0

그게 정확히 무엇입니까? 어떻게 확인합니까? – cmario

+0

Android Studio에서 디자인/미리보기를 사용하지 않는 이유는 무엇입니까? 레이아웃이 어떻게 생겼는지 정확히 알 수 있으며 위와 같은 문제를 발견 할 수 있어야합니다 ... – Melquiades

답변

0

레이아웃을 어렵게 정의하는 것은 좋지 않습니다. 사용자가 화면의 특정 공간을 차지하도록하려면 레이아웃 가중치를 조사해야합니다. 또는 TextView 높이에 wrap_content를 사용합니다. 그러나 ScrollView 내의 일부 상황에서는이 문제를 해결할 수 있습니다.

스크롤하지 않습니까?

VideoView는 콘텐츠를 콘텐츠에 넣기 전까지는로드되거나 표시되지 않을 수도 있습니다. 이는 높이에 대한 wrap_content가 있기 때문입니다. 그때까지는 높이가 없습니다. 그것은 지금 당신이 경험하고있는 것일 수 있습니다.

관련 문제