2015-01-05 4 views
-3

I했습니다 다양한 요소와 나는 장치가 가로 모드에있을 때 (YouTube와 같은) 전체 화면으로 확장하는 유일한 VideoView를 지켜 보면서 요소 싶은 다음과 같은 XML :VideoView를 지켜 보면서

<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="#FFFFFF" 
    tools:context=".VideoMapPanel" > 

    <com.sothree.slidinguppanel.SlidingUpPanelLayout 
     xmlns:sothree="http://schemas.android.com/apk/res-auto" 
     android:id="@+id/sliding_layout" 
     android:layout_width="match_parent" 
     android:layout_height="match_parent" 
     android:gravity="bottom" 
     sothree:panelHeight="68dp" 
     sothree:shadowHeight="4dp" 
     sothree:paralaxOffset="100dp" 
     sothree:dragView="@+id/dragView" 
     > 

     <!-- MAIN CONTENT --> 
     <FrameLayout 

      android:layout_width="match_parent" 
      android:layout_height="match_parent" 
      android:orientation="vertical"> 
      <android.support.v7.widget.Toolbar 
       xmlns:sothree="http://schemas.android.com/apk/res-auto" 
       xmlns:android="http://schemas.android.com/apk/res/android" 
       android:id="@+id/main_toolbar" 
       android:layout_height="?attr/actionBarSize" 
       android:background="?attr/colorPrimary" 
       sothree:theme="@style/ActionBar" 
       android:layout_width="match_parent"/> 
      <TextView 
       android:id="@+id/main" 
       android:layout_width="match_parent" 
       android:layout_height="match_parent" 
       android:layout_marginTop="?attr/actionBarSize" 
       android:gravity="center" 
       android:text="Main Content" 
       android:clickable="true" 
       android:focusable="false" 
       android:focusableInTouchMode="true" 
       android:textSize="16sp" /> 


       <fragment 
     android:id="@+id/map" 
     android:layout_width="match_parent" 
     android:layout_height="match_parent" 
     class="com.google.android.gms.maps.MapFragment" /> 

     </FrameLayout> 

     <!-- SLIDING LAYOUT --> 
     <LinearLayout 
      android:layout_width="match_parent" 
      android:layout_height="match_parent" 
      android:background="#eeeeee" 
      android:orientation="vertical" 
      android:clickable="true" 
      android:focusable="false" 
      android:id="@+id/dragView"> 

      <LinearLayout 
       android:layout_width="match_parent" 
       android:layout_height="68dp" 
       android:id="@+id/main_title_bar" 
       android:orientation="horizontal"> 

       <TextView 
        android:id="@+id/tvName" 
        android:layout_width="0dp" 
        android:layout_height="match_parent" 
        android:layout_weight="1" 
        android:textSize="20sp" 
        android:textColor="@android:color/white" 
        android:textStyle="bold" 
        android:background="#FF8800" 
        android:gravity="center_vertical" 
        android:paddingLeft="10dp"/> 

         <ProgressBar 
      android:id="@+id/progressBar" 
      style="?android:attr/progressBarStyleLarge" 
      android:layout_width="50dip" 
      android:layout_height="match_parent" 
      android:gravity="center_vertical" 
      android:background="#FF8800" 
      android:visibility="gone" > 
     </ProgressBar> 

        <ImageView 
        android:id="@+id/tvLogo" 
        android:layout_width="50dip" 
        android:background="#FF8800" 
        android:layout_height="match_parent" 
        android:paddingRight="10dp" 
        android:gravity="center_vertical" /> 

      </LinearLayout> 


      <VideoView 
     android:id="@+id/liveView" 
     android:clickable="true" 
     android:paddingLeft="10dp" 
     android:paddingRight="10dp" 
     android:layout_width="wrap_content" 
     android:layout_height="match_parent" 
     android:layout_gravity="center"/> 


      <ImageButton 
     android:id="@+id/videoPlayButton" 
     android:layout_width="wrap_content" 
     android:layout_height="wrap_content" 
     android:background="@null" 
     android:layout_gravity="center" 
     android:layout_margin="10dp" 
     android:src="@drawable/videoplaybutton" > 
    </ImageButton> 

      <LinearLayout 
       android:id="@+id/menuLayout" 
       android:background="#FFFFFF" 
       android:layout_width="match_parent" 
       android:layout_height="68dp" 
       android:orientation="horizontal"> 



            <ImageButton 
        android:id="@+id/fbLogo" 
        android:background="#FFFFFF" 
        android:layout_width="fill_parent" 
        android:layout_height="match_parent" 
        android:layout_weight="0.8" 
        android:src="@drawable/facebook_logo" 
        /> 


         <ImageButton 
        android:id="@+id/twitterLogo" 
        android:background="#FFFFFF" 
        android:layout_width="fill_parent" 
        android:layout_height="match_parent" 
        android:layout_weight="0.8" 
        android:src="@drawable/twitter_logo" 
        /> 



        <ImageButton 
        android:id="@+id/webLogo" 
        android:background="#FFFFFF" 
        android:layout_width="fill_parent" 
        android:layout_height="match_parent" 
        android:layout_weight="0.8" 
        android:src="@drawable/web_logo"/>  

      </LinearLayout> 

    <ScrollView 
     android:layout_width="fill_parent" 
     android:layout_height="wrap_content" > 

      <com.myapp.tv.ExpandableTextView 
        android:id="@+id/tvDescription" 
        android:layout_width="wrap_content" 
        android:layout_height="wrap_content" 
        android:textSize="14sp" 
        android:textColor="@android:color/black" 
        android:gravity="center_vertical" 
        android:paddingTop="10dp" 
        android:paddingLeft="10dp" 
        android:paddingRight="10dp"/> 

      </ScrollView> 

</LinearLayout> 
</com.sothree.slidinguppanel.SlidingUpPanelLayout> 

</RelativeLayout> 

프로그래밍 방식으로이 문제를 해결해야합니까?

답변

2

다른 레이아웃 파일을 사용하여이 문제를 해결할 것입니다.

나는 내가 당신이 게시 된 레이아웃은 고해상도/레이아웃/my_layout.xml에 저장됩니다 상상 현재 http://developer.android.com/training/basics/supporting-devices/screens.html#create-layouts

에서 살펴 보도록 것

당신이 할 수있는 것은 다른 파일 입술을 만들 것입니다/레이아웃 - land/my_layout.xml을 사용하고 레이아웃이 정의 된 동일한 레이아웃 대신 VideoView 요소가 전체 화면에 표시됩니다. 다른 구성 요소를 사용하는 경우 레이아웃에 해당 구성 요소를 포함 시키거나 코드에서 null 뷰를 정상적으로 처리해야합니다. 레이아웃에 포함시키고 가시성을 없애기 위해 레이아웃에 포함시킬 수 있습니다.

+0

이미이 솔루션을 사용해 보았지만 xml에서 발견 한 것처럼지도 조각이 있습니다. 그래서 새로운 동일한 레이아웃을로드 (심지어 가시성 : 요소에 대한 사라) 응용 프로그램이 충돌하게 : 원인 : java.lang.IllegalArgumentException : 이진 XML 파일 라인 # 51 : ID가 중복 0x7f0e0099, 태그 null 또는 부모 ID 0xffffffff 다른 com.google.android.gms.maps.MapFragment의 조각 – andreasperelli

+0

조각 안에이 레이아웃을로드하고 있습니까? 당신이 그때이면, 나의 나쁜, 그렇습니다 당신은 프로그램으로 이것을 해결해야한다. 이 경우 문제는 조각 안에 조각이 있다는 것입니다. http://developer.android.com/about/versions/android-4.2.html#NestedFragments 참고 : 레이아웃에 이 포함되어 있으면 조각을 펼칠 수 없습니다. 중첩 된 조각은 조각에 동적으로 추가 될 때만 지원됩니다. 동적으로 추가하는 프레임 레이 아웃을 원할 것입니다. – mlaHackingIsMagic

관련 문제