2017-02-04 20 views
0

私はタイトルバーの間隔ですべての私のレイアウトを動かす刺激性のバグで実行している、そこにいるタイトルバーのない私の画面の上部にあるタイトルバーの間隔で空白スペース。エミュレータ「Profile:Nexus 5x」で動作しているときにこのスペースがありますが、Oneplus 3では正常です。アンドロイド:

タイトルバーとして扱うことで削除しようとしましたが、他にもあるかもしれないと思われます。

私のすべてのレイアウトを通してユニバーサルパディングのようなsomの種類。私はこんなに大変です。

XMLを編集するときにそれはまた、「デザイン」ウィンドウで見ることができます。編集編集=========================================

EDIT編集編集EDIT

私はroughhike bottomBarライブラリを使用し、3つの以上のアイコンを表示しようとしていることが判明が、何らかの理由により、画面の上に余分なスペースをpropmpted。ネイティブデザインライブラリ "BottomNavigationView"を使用した後、私は問題はありませんでした。編集編集=========================================

EDIT編集編集EDIT

tiltebarとの間隔が、タイトルバーにならないことができるものの任意のアイデア?

enter image description here

アンドロイドのmanifest.xml: `

<application 
     android:allowBackup="true" 
     android:icon="@mipmap/ic_launcher" 
     android:label="@string/app_name" 
     android:supportsRtl="false"> 
     <activity 
      android:name=".MainActivity" 
      android:theme="@style/AppTheme.NoActionBar">` 

Style.xml:`

<style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar"> 

      <item name="colorPrimary">@color/colorPrimary</item> 
      <item name="colorPrimaryDark">@color/colorPrimaryDark</item> 
      <item name="colorAccent">@color/colorAccent</item> 
      <item name="windowActionBar">false</item> 
      <item name="windowNoTitle">true</item> 


     </style> 

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

     </style>` 

Activity_main.xml: `

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

<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android" 
    xmlns:app="http://schemas.android.com/apk/res-auto" 
    xmlns:tools="http://schemas.android.com/tools" 
    android:id="@+id/content_main" 
    android:layout_width="match_parent" 
    android:layout_height="match_parent"> 


     <com.roughike.bottombar.BottomBar 
      android:id="@+id/bottomBar" 
      android:layout_width="match_parent" 
      android:layout_height="60dp" 
      android:layout_alignParentBottom="true" /> 

</FrameLayout> 

`

content_main:`

<?xml version="1.0" encoding="utf-8"?> 
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" 
xmlns:app="http://schemas.android.com/apk/res-auto" 
xmlns:tools="http://schemas.android.com/tools" 
android:id="@+id/content_main" 
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" 
app:layout_behavior="@string/appbar_scrolling_view_behavior" 
tools:context="com.example.razze.roomee.MainActivity" 
tools:showIn="@layout/app_bar_main"> 

</RelativeLayout> 

`

MainActivity.java

`

package com.example.razze.roomee; 


public class MainActivity extends AppCompatActivity { 


    private static Context mContext; 
    private static Point windowsSize; 
    private FragmentManager fragmentManager; 
    BottomBar bottomBar; 

    @Override 
    protected void onCreate(Bundle savedInstanceState) { 

     super.onCreate(savedInstanceState); 
     requestWindowFeature(Window.FEATURE_NO_TITLE); //before 
     setContentView(R.layout.activity_main); 

     // HomeActivity uses these 
     mContext = getApplicationContext(); 
     windowsSize = Utility.getDisplaySize(getWindowManager()); 

     // Declares bottomBar and it's items 
     bottomBar = (BottomBar) findViewById(R.id.bottomBar); 
     bottomBar = BottomBar.attach(this, savedInstanceState); 
     bottomBar.setItems(R.menu.bottombar_menu); 
     bottomBar.setDefaultTabPosition(2); 

     // BottomBar OnClickListener 
     bottomBar.setOnMenuTabClickListener(new OnMenuTabClickListener() { 


      @Override 
      public void onMenuTabSelected(@IdRes int menuItemId) { 

       fragmentManager = getFragmentManager(); 

       System.out.println("Menu selected: " + menuItemId); 

       switch (menuItemId){ 

        case R.id.preferences: 

         fragmentManager.beginTransaction() 
           .replace(R.id.content_main, 
              new PreferencesActivity()) 
           .commit(); 
         break; 

        case R.id.matches: 

          fragmentManager.beginTransaction() 
            .replace(R.id.content_main, 
              new MatchesActivity()) 
            .commit(); 
         break; 

        case R.id.settings: 

         fragmentManager.beginTransaction() 
           .replace(R.id.content_main, 
              new SettingsActivity()) 
           .commit(); 
         break; 

        case R.id.home: 

          fragmentManager.beginTransaction() 
            .replace(R.id.content_main, 
              new HomeActivity()) 
            .commit(); 
         break; 

        case R.id.message: 

          fragmentManager.beginTransaction() 
            .replace(R.id.content_main, 
              new MessageActivity()) 
            .commit(); 
         break; 
       } 

      } 

      // When an icon in BottomBar that is selected, gets selected. 
      @Override 
      public void onMenuTabReSelected(@IdRes int menuItemId) {  } 

     }); 

     // Colors the bottombar (DOESNT WORK FOR SOME REASON 
     //bottomBar.mapColorForTab(0, "#FF9800"); 
     //bottomBar.mapColorForTab(1, "#FF5252"); 
     //bottomBar.mapColorForTab(2, "#7B1FA2"); 
     //bottomBar.mapColorForTab(3, "#FFF352"); 
     //bottomBar.mapColorForTab(4, "#455FA2"); 


    } 

    // HomeActivity uses these 
    public static Context getMainContext(){ return mContext; } 

    public static Point getWindowSize(){ return windowsSize; } 



} 

`

任意の助けを事前に感謝は、はるかに高く評価されるだろう。

答えて

0

uは使用できactivityフルスクリーンにする:

方法RES /値/スタイルで1

<activity android:name=".MainActivity" 
    android:label="@string/app_name" 
    android:theme="@style/Theme.AppCompat.Light.NoActionBar.FullScreen"> 
</activity> 

を。xml;

<style name="Theme.AppCompat.Light.NoActionBar.FullScreen" parent="@style/Theme.AppCompat.Light"> 
    <item name="windowNoTitle">true</item> 
    <item name="windowActionBar">false</item> 
    <item name="android:windowFullscreen">true</item> 
    <item name="android:windowContentOverlay">@null</item> 
</style> 

方法2:使用requestWindowFeature機能

requestWindowFeature(Window.FEATURE_NO_TITLE); 
getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, 
           WindowManager.LayoutParams.FLAG_FULLSCREEN);   

setContentView(R.layout.activity_main); 

また上部または下部

+0

あなたのアクションバーでもメインコンテンツにパディングトップを削除してみてください削除してください上記の言ったように:しようとしましたが、それは、バイナリXMLエラーに走った: "android.view.InflateException:バイナリXML方法2:動作しませんでした。ステータスバーを削除しました。 –

+0

編集を確認してください。また、他のビューを持っていないことを確認してください。 ''ファイルの行番号2:バイナリXMLファイルの行番号2: appbar'、あなたのレイアウトの 'ツールバー' ..そこに投稿されたコードからは、あまり見つからない.. – rafsanahmad007

+0

うまくいかなかった。違いは見られません。私のapp_bar_mainでandroid.support.v7.widget.Toolbarを削除しても、そのトリックはありませんでした。 –

0

変更content_mainから不要なパディングを削除:

<?xml version="1.0" encoding="utf-8"?> 
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" 
xmlns:app="http://schemas.android.com/apk/res-auto" 
xmlns:tools="http://schemas.android.com/tools" 
android:id="@+id/content_main" 
android:layout_width="match_parent" 
android:layout_height="match_parent" 
app:layout_behavior="@string/appbar_scrolling_view_behavior" 
tools:context="com.example.razze.roomee.MainActivity" 
tools:showIn="@layout/app_bar_main"> 

</RelativeLayout> 
+0

残念ながら、うまくいきませんでした。 –

0

は、方法1 android:paddingTop="@dimen/activity_vertical_margin"

+0

私はそれを "0dp"に調整しようとしましたが、それは効果がありませんでした。取り除こうとしたが効果がなかった。 –