2016-03-28 8 views
0

Ich habe Probleme beim Entfernen der zusätzlichen Polsterung standardmäßig eingestellt. Ich bin nicht wirklich vertraut mit Java, dass viel, aber ich habe die Marge und die Polsterung zu 0DP des Linear Layout (vertikal) und die Tasten sind noch nicht für die ganze Seite gesetzt.Android App - entfernen Sie zusätzliche Polster

Um klarer zu sein, möchte ich die Tasten die gesamte Titelseite abdecken. Keine der grauen Bereiche sichtbar zu sein.

Visuell:

enter image description here

styles.xml

resources> 

    <!-- Base application theme. --> 
    <style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar"> 
     <!-- Customize your theme here. --> 
     <item name="colorPrimary">@color/colorPrimary</item> 
     <item name="colorPrimaryDark">@color/colorPrimaryDark</item> 
     <item name="colorAccent">@color/colorAccent</item> 
    </style> 

    <style name="AppTheme.NoActionBar"> 
     <item name="windowActionBar">false</item> 
     <item name="windowNoTitle">true</item> 
    </style> 

    <style name="AppTheme.AppBarOverlay" parent="ThemeOverlay.AppCompat.Dark.ActionBar" /> 

    <style name="AppTheme.PopupOverlay" parent="ThemeOverlay.AppCompat.Light" /> 

</resources> 

activity_main.xml

<?xml version="1.0" encoding="utf-8"?> 
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" 
    xmlns:tools="http://schemas.android.com/tools" 
    android:layout_width="match_parent" 
    android:layout_height="match_parent" 
    android:paddingBottom="@dimen/activity_vertical_margin" 
    android:paddingLeft="@dimen/activity_horizontal_margin" 
    android:paddingRight="@dimen/activity_horizontal_margin" 
    android:paddingTop="@dimen/activity_vertical_margin" 
    tools:context="com.example.it5.foothillers.MainActivity" 
    android:background="#f4f4f4"> 

    <LinearLayout 
     android:orientation="vertical" 
     android:layout_width="fill_parent" 
     android:layout_height="fill_parent" 
     android:weightSum="1" 
     android:paddingEnd="0dp" 
     android:paddingStart="0dp" 
     android:layout_margin="0dp"> 

     <Button 
      android:layout_width="fill_parent" 
      android:layout_height="23dp" 
      android:text="NEWS" 
      android:id="@+id/button" 
      android:layout_weight="0.24" 
      android:background="@android:color/holo_blue_bright" 
      android:textColor="#ffffff" 
      android:textSize="48dp" /> 

     <Button 
      android:layout_width="match_parent" 
      android:layout_height="wrap_content" 
      android:text="SPORTS" 
      android:id="@+id/button2" 
      android:layout_weight="0.24" 
      android:background="@android:color/holo_blue_light" 
      android:textColor="#ffffff" 
      android:textSize="48dp" /> 

     <Button 
      android:layout_width="match_parent" 
      android:layout_height="24dp" 
      android:text="EVENTS" 
      android:id="@+id/button3" 
      android:layout_weight="0.24" 
      android:background="@android:color/holo_blue_dark" 
      android:textColor="#ffffff" 
      android:textSize="48dp" /> 

     <Button 
      android:layout_width="match_parent" 
      android:layout_height="24dp" 
      android:text="MORE" 
      android:id="@+id/button4" 
      android:layout_weight="0.24" 
      android:background="#f1f108" 
      android:textSize="48dp" /> 
    </LinearLayout> 
</RelativeLayout> 
+0

Sie haben diesen Teil 'android: paddingBottom =" @ dimen/activity_vertical_margin "' im Layout der obersten Ebene nicht gesehen? – njzk2

Antwort

1

Sie müssen nur aus diesen Linien entfernen activity_main.xml

android:paddingBottom="@dimen/activity_vertical_margin" 
android:paddingLeft="@dimen/activity_horizontal_margin" 
android:paddingRight="@dimen/activity_horizontal_margin" 
android:paddingTop="@dimen/activity_vertical_margin" 
+0

Hey, du bist ein Held! DANKE @ Dmitri – Martintoobeast

1

Sie @ finden Dimen/activity_vertical_margin und Sollwert als 0DP auch .. diese Weise, wenn Sie in Zukunft wieder die Sie hinzufügen möchten, dann verwenden diese können ..

Speicherort der Datei res/Werte/dimen.xml

+0

Sie haben mir gerade etwas Neues beigebracht! Danke @Shyam – Martintoobeast

1

Sie haben noch die Polsterung aus Ihrem RelativeLayout:

android:paddingBottom="@dimen/activity_vertical_margin" 
android:paddingLeft="@dimen/activity_horizontal_margin" 
android:paddingRight="@dimen/activity_horizontal_margin" 
android:paddingTop="@dimen/activity_vertical_margin" 

Werden Sie diese los und Sie sollten in Ordnung sein.

+0

Hey danke, aber die erste Antwort funktionierte für mich schon. Aber danke! – Martintoobeast

Verwandte Themen