0

안녕하세요 저는 단일 레이아웃에서 두 조각을 만들었습니다.안드로이드의 세로 모드와 가로 모드의 다른 디자인

레이아웃 - 랜드에서 :

조각을 수평으로 표시해야합니다.

레이아웃 포트 : 조각을 세로로 표시해야합니다.

이제 세로 모드에서 앱을 실행하면 조각을 세로로 표시한다는 의미입니다. 이제 가로 모드로 회전해야만 조각이 세로로 만 표시됩니다.

가로 모드에서 응용 프로그램을 실행해야 함은 가로로 조각을 표시한다는 의미입니다. 세로 모드로 회전하면 가로로 조각을 표시한다는 의미입니다. 수직 조각을 표시하는 의미 난 세로 모드에서 응용 프로그램을 실행해야

:

는하지만 난 출력처럼 표시하고 싶습니다. 이제 가로 모드로 회전해야만 조각이 가로로 표시됩니다.

동시에 가로 모드에서 앱을 실행해야 함은 가로로 조각을 표시하는 것을 의미합니다. 세로 모드로 회전해야 함으로 세로로 조각을 표시해야합니다.

어떻게 할 수 있습니까 ???

위와 같은 결과가 나타나는 이유는 무엇입니까? 제게 제안 해주세요.

편집 :

레이아웃 - 토지 : fragment.xml :

<?xml version="1.0" encoding="utf-8"?> 
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" 
android:layout_width="fill_parent" 
android:layout_height="fill_parent" 
android:orientation="vertical" 
android:id="@+id/_listDetails" 

> 
    <ImageView 
     android:id="@+id/refresh" 
     android:layout_width="wrap_content" 
     android:layout_height="45dp" 

     android:layout_gravity="center_vertical" 
     android:layout_toLeftOf="@+id/pos" 
     android:src="@drawable/ref_off" /> 
<LinearLayout 
android:layout_width="fill_parent" 
android:layout_height="fill_parent" 
android:layout_below="@+id/layout" 
android:background="#414042" 
android:orientation="horizontal" > 

<fragment 
    android:id="@+id/activity_main" 
    android:name="com.notch.notchbolly.MainActivity" 
    android:layout_width="0px" 
    android:layout_height="match_parent" 
    android:layout_weight="0.83" 

    /> 
    <View 
    android:layout_width="2dp" 
    android:layout_height="fill_parent" 
    android:background="#FFFFFF" 
    /> 
<fragment 
    android:id="@+id/subcate" 
    android:name="com.notch.notchbolly.SubCate" 
    android:layout_width="0px" 
    android:layout_height="match_parent" 
    android:layout_weight="1" /> 
    </LinearLayout> 
    </RelativeLayout> 

레이아웃 포트 : fragment.xml : 이것은 내 AndroidListFragmentActivity이

<?xml version="1.0" encoding="utf-8"?> 
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" 
android:layout_width="fill_parent" 
android:layout_height="fill_parent" 
android:orientation="vertical" 
android:id="@+id/_listDetails" 

> 
    <ImageView 
     android:id="@+id/refresh" 
     android:layout_width="wrap_content" 
     android:layout_height="45dp" 

     android:layout_gravity="center_vertical" 
     android:layout_toLeftOf="@+id/pos" 
     android:src="@drawable/ref_off" /> 
<LinearLayout 
android:layout_width="fill_parent" 
android:layout_height="fill_parent" 
android:layout_below="@+id/layout" 
android:background="#414042" 
android:id="@+id/orien" 
android:orientation="vertical" 
> 

<fragment 
    android:id="@+id/activity_main" 
    android:name="com.notch.notchbolly.MainActivity" 
    android:layout_width="fill_parent" 
    android:layout_height="200dp" 

    /> 
<View 
    android:layout_width="fill_parent" 
    android:layout_height="3dp" 
    android:background="#FF0000" 
    /> 
<fragment 
    android:id="@+id/subcate" 
    android:name="com.notch.notchbolly.SubCate" 
    android:layout_width="fill_parent" 
    android:layout_height="fill_parent" 
    /> 


    </LinearLayout> 
    </RelativeLayout> 

입니다 :

public class AndroidListFragmentActivity extends FragmentActivity { 


     /** Called when the activity is first created. */ 
    @Override 
     public void onCreate(Bundle savedInstanceState) { 
    super.onCreate(savedInstanceState); 
    setContentView(R.layout.fragment); 

    ImageView refresh = (ImageView) findViewById(R.id.refresh); 
     refresh.setOnClickListener(new OnClickListener() { 
      public void onClick(View v) { 

       Intent in = new Intent(AndroidListFragmentActivity.this, AndroidListFragmentActivity.class); 
       startActivity(in); 
       } 
      }); 



       } 
      @Override 
      public void onConfigurationChanged (Configuration newConfig) 
       { 
       super.onConfigurationChanged(newConfig); 

     } 

     } 
+0

https://www.youtube.com/watch?v=3FMn4FEv12M이 동영상 확인 – TheFlash

답변

1

매니페스트 파일의 활동 선언에서 android:configChanges="orientation"을 제거하십시오.

+0

나는 이것들을 완벽하게 제거했습니다 ...하지만 로딩 시간은 ... ... 오리엔테이션이 바뀌면 로딩 시간을 사용하지 않고 다른 Ui를 표시해야합니다 .. – user2218667

+0

오리엔테이션이 변경되면 레이아웃이 파괴되어 다시 생성됩니다. 새로운 오리엔테이션을위한 자원. 그래서 약간의 로딩 시간이 걸립니다. –

+0

아니요 ... 여기 내 활동에 너무 많은 시간이 걸립니다 ... 여기 방향을 바꾸어야 만합니다. 전체 활동이 다시로드됨을 의미합니다. 이러한 필요가 없었습니다 .i 필요없이 표시해야합니다. 로딩 시간 – user2218667

관련 문제