2012-04-21 8 views
0

私はAndroid開発の相対性点が新しいですが、私は速いですね。私はソフトボールチームのために作ったアプリを再作ってきました。以前はGoogleのApp Inventorを使っていましたが、多くの欠点がありましたので、Eclipseを使用して再作成しようとしています。TabHostでのレイアウトの不要なマージン

とにかく、ポイントです。 LinearLayoutに余分な余白が追加されているようですが、どこから来ているのかわかりません。

私はTabHostを使用してトップにタブを作成しています(Googleのタブの例の変更版)。

レイアウトXML:

<?xml version="1.0" encoding="utf-8"?> 

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" 
    android:id="@+id/main_linlay_parent" 
    android:orientation="vertical" 
    android:layout_width="match_parent" 
    android:layout_height="match_parent" 
    > 

    <TabHost 
     android:id="@android:id/tabhost" 
     android:layout_width="match_parent" 
     android:layout_height="match_parent" 
     > 

      <RelativeLayout 
       android:orientation="vertical" 
       android:layout_width="match_parent" 
       android:layout_height="match_parent" 
       android:background="@drawable/background" 
       >   

       <!-- Allow the "Tabs" to scroll horizontally --> 
       <HorizontalScrollView 
        android:layout_width="match_parent" 
        android:layout_height="match_parent" 
        android:fillViewport="true" 
        android:scrollbars="none" 
        > 

        <!-- The "Tabs" widget --> 
        <TabWidget 
         android:id="@android:id/tabs" 
         android:layout_width="wrap_content" 
         android:layout_height="wrap_content" 
         android:background="#000000" 
         /> 

       </HorizontalScrollView> 

       <!-- Provide the "Content" the ability to vertically scroll --> 
       <ScrollView 
        android:layout_width="match_parent" 
        android:layout_height="match_parent" 
        android:layout_marginTop="65dp" 
        > 
        <FrameLayout 
         android:id="@android:id/tabcontent" 
         android:layout_width="match_parent" 
         android:layout_height="wrap_content" 
         > 
         <LinearLayout 
          android:id="@+id/tabdata" 
          android:orientation="vertical" 
          android:layout_width="match_parent" 
          android:layout_height="match_parent" 
          > 
         </LinearLayout> 
        </FrameLayout> 
       </ScrollView> 
      </RelativeLayout> 
    </TabHost> 
</LinearLayout> 

私はScrollViewでandroid:layout_marginTop="65dp"で、私はそれを削除した場合、私のタブが消える(私は私のtabcontentがちょうどトップの上にオーバーレイされていると仮定しているに問題があると考えていそれの)。

最後に、私が経験していることの例を示すスクリーンショットです(XMLストリングを無視して、まだその部分をマッサージする必要があります)。 http://kahunaball.com/android/screenshot_0.jpg

答えて

0

XMLを最初から起動して少し前に進んだ後、XMLを再作成して余分な埋め込みをレイアウトから解決できました。

私は違いを作った変更は100%わからないんだけど、私の疑惑はLinearLayoutRelativeLayoutを変更し、FrameLayoutLinearLayoutTableLayout外に移動すると、トリックを行っていたものだったということです。この出くわすことがあり、問題を解決し、私の新しいXMLを見たいのですが、他人のために

は、ここにある:

<?xml version="1.0" encoding="utf-8"?> 
<TabHost 
    xmlns:android="http://schemas.android.com/apk/res/android" 
    android:id="@android:id/tabhost" 
    android:layout_width="match_parent" 
    android:layout_height="match_parent" > 
    <LinearLayout 
     android:orientation="vertical" 
     android:layout_width="match_parent" 
     android:layout_height="match_parent" 
     android:background="@drawable/background"> 
     <HorizontalScrollView 
      android:layout_width="match_parent" 
      android:layout_height="wrap_content" 
      android:fillViewport="true" 
      android:scrollbars="none"> 
      <TabWidget 
       android:id="@android:id/tabs" 
       android:layout_width="wrap_content" 
       android:layout_height="wrap_content" 
       android:background="#000000" /> 
     </HorizontalScrollView> 
     <ScrollView 
      android:layout_width="match_parent" 
      android:layout_height="match_parent" > 
      <HorizontalScrollView 
       android:layout_width="match_parent" 
       android:layout_height="wrap_content" 
       android:fillViewport="true" 
       android:scrollbars="none" > 
       <FrameLayout 
        android:id="@android:id/tabcontent" 
        android:layout_width="wrap_content" 
        android:layout_height="match_parent" > 
        <LinearLayout 
         android:id="@+id/tabdata" 
         android:orientation="vertical" 
         android:layout_width="match_parent" 
         android:layout_height="match_parent" 
         android:gravity="center_horizontal" /> 
        <TableLayout 
         android:id="@+id/myTableLayout" 
         android:layout_width="wrap_content" 
         android:layout_height="wrap_content" 
         android:background="#33B5E5" /> 
       </FrameLayout> 
      </HorizontalScrollView> 
     </ScrollView> 
    </LinearLayout> 
</TabHost> 
関連する問題