2013-07-08 5 views
1

xml 벨로우즈는 API에 따라 두 개의 별개의 레이아웃 화면을 생성합니다. API 17이있는 장치의이 레이아웃은 입력 텍스트가 화면 중앙에 배치되어 레이아웃이 좋아 보인다.동일한 XML - 다른 레이아웃 - API 10 및 API 17

그러나 API (10)에서 실행되는 동일한 레이아웃이 위쪽 왼쪽 모서리에있는 필드, 이상한 것 같다 ...

의 XML 코드는 다음과 같이 API를 10 뷰에

<?xml version="1.0" encoding="utf-8"?> 
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android" 
    android:layout_width="match_parent" 
    android:layout_height="match_parent" 
    android:background="#005500"> 

    <LinearLayout 
     android:layout_width="match_parent" 
     android:layout_height="wrap_content" 
     android:layout_marginLeft="15dip" 
     android:layout_marginRight="15dip" 
     android:layout_marginTop="200dip" 
     android:orientation="vertical" > 

     <EditText 
      android:id="@+id/et_nome_login" 
      android:layout_width="match_parent" 
      android:layout_height="40dip" 
      android:paddingRight="15dip" 
      android:paddingLeft="15dip" 
      android:inputType="text" 
      android:nextFocusDown="@+id/et_senha_login" 
      android:background="@drawable/bg_login_name"/> 

     <EditText 
      android:id="@+id/et_senha_login" 
      android:layout_width="match_parent" 
      android:layout_height="40dip" 
      android:paddingRight="15dip" 
      android:paddingLeft="15dip" 
      android:inputType="textPassword" 
      android:background="@drawable/bg_login_senha"/> 

     <ImageButton 
      android:id="@+id/ib_login" 
      android:layout_width="match_parent" 
      android:layout_height="50dip" 
      android:layout_marginTop="20dip" 
      android:background="@drawable/btn_entrar"/> 

    </LinearLayout> 


    <FrameLayout 
      android:id="@+id/progress_login" 
      android:layout_width="match_parent" 
      android:layout_height="match_parent" 
      android:background="#AA000000" 
      android:clickable="true" 
      android:focusable="true" 
      android:focusableInTouchMode="true" 
      android:visibility="gone" > 

      <ProgressBar 
       android:layout_width="50dp" 
       android:layout_height="50dp" 
       android:focusable="true" 
       android:focusableInTouchMode="true" 
       android:layout_gravity="center" /> 
    </FrameLayout> 

</FrameLayout> 

좌측 상단 코너에 배치되고, API (17)에서는 필드가 중심에 위치하도록 수정된다. 문제가 어디에 있습니까?

<include layout="@layout/include_file" /> 

다른 XML은 같은 이름을 가진 자신의 API 폴더에 있어야합니다 :

답변

0

서로 다른 XML을 포함 할 수

값-V11

  • include_file.xml
  • 을 .. .

개 값-V14

  • include_file.xml
  • ...
+0

감사의 말을 전하고 싶습니다. 아니면 이해가 안 돼요 ... 레이아웃이 같아야합니다 .... 제 질문은 왜 sabe XML API에 따라 두 개의 서로 다른 화면을 생성합니다 ...이 레이아웃은 안드로이드의 부분을 할 요소가 포함되어 있습니다 API의 이전 버전 .... 나는이 차이를 이해할 수 없다 ... – user717151

1
당신은 모든 크기 또는 API에서 하나의 XML을 실행하는 데 무게 속성을 사용해야합니다

.

시도해보십시오. link

+0

답장을 보내 주셔서 감사합니다. 체중을 사용하여 여러 조합을 시도했지만 작동하지 않았습니다. 그것은 같은 행동을 .... – user717151