私はタイトルバーの間隔ですべての私のレイアウトを動かす刺激性のバグで実行している、そこにいるタイトルバーのない私の画面の上部にあるタイトルバーの間隔で空白スペース。エミュレータ「Profile:Nexus 5x」で動作しているときにこのスペースがありますが、Oneplus 3では正常です。アンドロイド:
タイトルバーとして扱うことで削除しようとしましたが、他にもあるかもしれないと思われます。
私のすべてのレイアウトを通してユニバーサルパディングのようなsomの種類。私はこんなに大変です。
XMLを編集するときにそれはまた、「デザイン」ウィンドウで見ることができます。編集編集=========================================
EDIT編集編集EDIT
私はroughhike bottomBarライブラリを使用し、3つの以上のアイコンを表示しようとしていることが判明が、何らかの理由により、画面の上に余分なスペースをpropmpted。ネイティブデザインライブラリ "BottomNavigationView"を使用した後、私は問題はありませんでした。編集編集=========================================
EDIT編集編集EDIT
tiltebarとの間隔が、タイトルバーにならないことができるものの任意のアイデア?
アンドロイドの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; }
}
`
任意の助けを事前に感謝は、はるかに高く評価されるだろう。
あなたのアクションバーでもメインコンテンツにパディングトップを削除してみてください削除してください上記の言ったように:しようとしましたが、それは、バイナリXMLエラーに走った: "android.view.InflateException:バイナリXML方法2:動作しませんでした。ステータスバーを削除しました。 –
編集を確認してください。また、他のビューを持っていないことを確認してください。 ''ファイルの行番号2:バイナリXMLファイルの行番号2: appbar'、あなたのレイアウトの 'ツールバー' ..そこに投稿されたコードからは、あまり見つからない.. – rafsanahmad007
うまくいかなかった。違いは見られません。私のapp_bar_mainでandroid.support.v7.widget.Toolbarを削除しても、そのトリックはありませんでした。 –