2016-12-26 7 views
0

다음 코드에 아래 코드를 게시합니다. 레이아웃에 표시된 공간의 위쪽에 다음과 같은 공백이 있습니다. 난 그냥 가기 공간을 제거하고 맨 위에 제목을 표시하려고합니다. 그러나 나는 그것을 설정하는 방법을 혼란스러워합니다. 제게 해결책을 제안 해주세요. 미리 감사드립니다.안드로이드 레이아웃이 제대로 표시되지 않습니다.

XML 파일

<?xml version="1.0" encoding="utf-8"?> 
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" 
       android:layout_width="match_parent" 
       android:layout_height="match_parent" 
       android:layout_gravity="top" 
       android:orientation="vertical" 
       android:weightSum="100"> 
    <LinearLayout 
     android:layout_width="match_parent" 
     android:layout_height="wrap_content" 
     android:orientation="horizontal" > 

     <TextView 
      android:id="@+id/folder_name" 
      android:layout_width="0dp" 
      android:layout_height="wrap_content" 
      android:layout_gravity="center" 
      android:paddingLeft="30dip" 
      android:textSize="15dp" 
      android:layout_weight="1" 
      android:textColor="#115c28"/> 

     <TextView 
      android:id="@+id/folder_count" 
      android:layout_width="0dp" 
      android:layout_height="60dp" 
      android:textSize="20dp" 
      android:textStyle="bold" 
      android:textColor="#115c28" 
      android:gravity="center" 
      android:paddingRight="30dip" 
      android:paddingLeft="35dip" 
      android:layout_weight="1" /> 
    </LinearLayout> 

    <ListView 
     android:id="@+id/folder_display_list" 
     android:layout_width="match_parent" 
     android:layout_height="wrap_content"/> 
</LinearLayout> 
+1

당신은 당신이 무엇을 달성하고자하는의 screencap이 있습니까? –

+0

안녕하세요, 저는 스크린 샷을 게시 할 수 없습니다. 문제는 배치가 이름을 보여주고 하나씩 적절하게 계산하지만 작업 표시 줄에서 상단의 공간이 있습니다. 해당 공간을 제거하고 싶습니다. –

답변

0

당신이 단지에서 당신이

<?xml version="1.0" encoding="utf-8"?> 
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" 
    android:layout_width="match_parent" 
    android:layout_height="match_parent" 
    android:orientation="vertical" 
    android:weightSum="100"> 

    <LinearLayout 
     android:layout_width="match_parent" 
     android:layout_height="wrap_content" 
     android:layout_gravity="top" 
     android:orientation="horizontal" > 

     <TextView 
      android:id="@+id/folder_name" 
      android:layout_width="0dp" 
      android:layout_height="wrap_content" 
      android:textSize="20sp" 
      android:layout_weight="1" 
      android:gravity="top|center" 
      android:textColor="#115c28"/> 

     <TextView 
      android:id="@+id/folder_count" 
      android:layout_width="0dp" 
      android:layout_height="60dp" 
      android:textSize="20sp" 
      android:textStyle="bold" 
      android:textColor="#115c28" 
      android:gravity="top|center" 
      android:layout_weight="1" /> 
    </LinearLayout> 

    <ListView 
     android:id="@+id/folder_display_list" 
     android:layout_width="match_parent" 
     android:layout_height="wrap_content"/> 
</LinearLayout> 
+0

동일한 o/p 표시 ..! –

+0

위의 코드 사본은 붙여 넣기는했지만 이전과 동일한 op를 표시합니다. –

0

여백 값을 확인하시기 바랍니다 작동하는 코드 아래에 비해 공간이없는 상단에있는 두 개의 텍스트 정렬에 대한 요청하는 경우 style.xml 파일은 values 디렉토리에 있습니다.

테마 매개 변수로 가득 차있을 수 있습니다.

+0

아무에게도 해결책을 말해주십시오 ...! –

0

XML

 <resources xmlns:android="http://schemas.android.com/apk/res/android"> 

     <!-- 
     Base application theme, dependent on API level. This theme is replaced 
     by AppBaseTheme from res/values-vXX/styles.xml on newer devices. 
     --> 
     <style name="AppBaseTheme" parent="android:Theme.Light"> 
     <!-- 
     Theme customizations available in newer API levels can go in 
     res/values-vXX/styles.xml, while customizations related to 
     backward-compatibility can go here. 
     --> 
     </style> 

     <!-- Application theme. --> 
     <style name="AppTheme" parent="AppBaseTheme"> 
     <!-- All customizations that are NOT specific to a particular API-level can go here. --> 
     </style> 

     <!--THIS ONE FOR THE CHANGE THE COLOR OF THE APPBAR STARTS --> 

     <style name="MyTheme" parent="@android:style/Theme.Holo.Light"> 
     <item name="android:actionBarStyle">@style/MyActionBar</item> 
     </style> 

     <style name="MyActionBar" parent="@android:style/Widget.Holo.Light.ActionBar"> 
     <item name="android:background">#CECFCE</item> 
     <item name="android:textAlignment">center</item> 
     </style> 


     <!--THIS ONE FOR THE CHANGE THE COLOR OF THE APPBAR STARTS --> 


     <!-- Theme : Green--> 
     <style name="ThemeSelector" parent="android:Theme.Light"> 
     <item name="android:windowTitleStyle">@style/headerTextStyle</item>   
     <item name="android:windowBackground">@color/white</item> 
     <item name="android:windowTitleSize">20dip</item> 
     <item name="android:windowTitleBackgroundStyle">@style/WindowTitleBackground</item> 
     </style>  

     <style name="headerTextStyle" > 
     <item name="android:textSize">10sp</item> 
     <item name="android:textColor">@color/black</item> 
     <item name="android:paddingLeft">10sp</item> 
     </style> 


     <style name="WindowTitleBackground">  
     <item name="android:background">@color/light_grey</item> 
     </style> 

     <style name="myOptionMenu">  
     <item name="android:background">@color/white</item> 
     <item name="android:textColor">@color/black</item> 
     </style> 

     <!-- color --> 
     <color name="green">#05781e</color> 
     <color name="white">#ffffff</color> 
     <color name="black">#000000</color> 
     <color name="red">#f71350</color> 
     <color name="grey">#666666</color> 
     <color name="light_grey">#bfbfbf</color> 

     <!-- end --> 

     </resources> 
관련 문제