2013-07-08 24 views
1

的XML波紋管生成根據API 2個distincts佈局屏幕。這種佈局與API 17的設備,佈局看起來不錯,與集中在屏幕上輸入文本。同一XML - 不同的佈局 - API 10和API 17

但在API 10運行相同的佈局似乎不可思議,在向上左上角的領域...

XML代碼片段如下:

<?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 10的看法放置在左上角,並且在API 17上,場被糾正放置在中心。哪裏有問題?

回答

0

可以包括不同的xml:

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

不同的XML必須與名稱相同的API文件夾:

值-V11

  • include_file.xml
  • .. 。

個值-V14

  • include_file.xml
  • ...
+0

感謝您的幫助,但事實並非如此。或者說我不理解...... 佈局必須是相同的....我的問題是,爲什麼薩韋XML取決於API生成兩個不同的屏幕上......這種佈局不僅包含自認爲做的是Android的一部分元素這些API的舊版本....我不理解這種差異... – user717151

1

你應該使用重屬性來運行各種規模或API中的一個XML。

試試這個link

+0

Rumit感謝您的回覆。 我嘗試使用重量多種組合,但沒有奏效。它有相同的行爲.... – user717151

相關問題