Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/android/196.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/codeigniter/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/xpath/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Android Appbar和Tablayout在屏幕外制作应用程序?_Android_Android Appbarlayout_Tabview - Fatal编程技术网

Android Appbar和Tablayout在屏幕外制作应用程序?

Android Appbar和Tablayout在屏幕外制作应用程序?,android,android-appbarlayout,tabview,Android,Android Appbarlayout,Tabview,我随后将Tablayout添加到我的活动中 在同一个房间里,我变了 从公共类家庭活动扩展活动到公共类家庭活动扩展活动 现在我越来越像这样了 我想在操作栏中显示选项菜单,但我得到了两个操作/应用程序栏布局 而且完整的布局丢失了 我需要的是动作栏和应用程序栏应该结合起来 有些文字丢失了,我是说,即使我删除了android:fitsSystemWindows=“true”如果我保留了这些文字,它也会在屏幕内,但在状态栏旁边,但如果我删除了应用程序的底部部分,它就会丢失 在我以前的应用程序中,一切都很

我随后将Tablayout添加到我的活动中

在同一个房间里,我变了

公共类家庭活动扩展活动
公共类家庭活动扩展活动

现在我越来越像这样了

我想在操作栏中显示选项菜单,但我得到了两个操作/应用程序栏布局

而且完整的布局丢失了

  • 我需要的是动作栏和应用程序栏应该结合起来
  • 有些文字丢失了,我是说,即使我删除了
    android:fitsSystemWindows=“true”
    如果我保留了这些文字,它也会在屏幕内,但在状态栏旁边,但如果我删除了应用程序的底部部分,它就会丢失
  • 在我以前的应用程序中,一切都很好,但由于Tablayout,我遇到了很多问题。。。 有人能给我推荐这种

    更新

    参考user@sanatchandravanshi我已经添加了
    ,而且我还添加了

    我已经在我的代码中添加了这个

    Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
    setSupportActionBar(toolbar);
    
    现在一切都很好,但我的应用程序在屏幕外重叠

    这是我的问题,如果我保留这个
    android:fitsystemwindows=“true”

    我得到了完整的应用程序屏幕,但顶部页面隐藏在状态栏旁边,如下所示

    但是如果我删除android:fitsSystemWindows=“true”的话,屏幕的底部就会溢出

    如上图所示


    有谁能建议我如何让应用程序与Statusbar、Appbar、TableLayout…配合在同一屏幕上吗?

    您需要在manisfest中放置no
    AppTheme.NoActionBar
    主题,例如:

    AndroidMenifest.xml

               <activity
                    android:name="view.activities.HomeActivity"
                    android:launchMode="singleTask"
                    android:screenOrientation="portrait"
                    //Change Theme to this
                    android:theme="@style/AppTheme.NoActionBar">
                    <intent-filter>
                        <action android:name="android.intent.action.MAIN" />
    
                        <category android:name="android.intent.category.LAUNCHER" />
                    </intent-filter>
                </activity>
    
      <style name="AppTheme.NoActionBar">
            <item name="windowActionBar">false</item>
            <item name="windowNoTitle">true</item>
        </style>
    
    
    
    把这个主题流行起来

    style.xml

               <activity
                    android:name="view.activities.HomeActivity"
                    android:launchMode="singleTask"
                    android:screenOrientation="portrait"
                    //Change Theme to this
                    android:theme="@style/AppTheme.NoActionBar">
                    <intent-filter>
                        <action android:name="android.intent.action.MAIN" />
    
                        <category android:name="android.intent.category.LAUNCHER" />
                    </intent-filter>
                </activity>
    
      <style name="AppTheme.NoActionBar">
            <item name="windowActionBar">false</item>
            <item name="windowNoTitle">true</item>
        </style>
    
    
    错误的
    符合事实的
    
    请将您的代码保留为

    公共类HomeActivity扩展了AppCompatActivity

    只需在
    style.xml的下面一行中添加

    <style name="AppTheme" parent="Theme.AppCompat.Light.NoActionBar">
    
    创建菜单并使用如下菜单:

    public class DetailActivity extends AppCompatActivity {
    Toolbar mToolbar;
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
            setContentView(R.layout.activity_gallery_detail);
        mToolbar = (Toolbar) findViewById(R.id.upload_gallery_app_bar);
            setSupportActionBar(mToolbar);
            getSupportActionBar().setDisplayOptions(ActionBar.DISPLAY_SHOW_HOME | ActionBar.DISPLAY_SHOW_TITLE);
            getSupportActionBar().setDisplayHomeAsUpEnabled(true);}
    
    @Override
    public boolean onCreateOptionsMenu(Menu menu) {
        getMenuInflater().inflate(R.menu.menu_gallery_detail, menu);
        return true;
    }}
    
    更新

    进行线性布局(而不是协调布局)
    如果我将主题更改为
    android:theme=“@style/AppTheme.NoActionBar”
    此处缺少选项菜单,请更改您的
    XML
    文件。。。应用程序的同一底部正在隐藏。。。我的应用程序已经是这个主题了,所以我添加了一个新的灯光主题。如果我添加了NoActionBar选项菜单丢失,但它解决了我问题的一部分,请检查我更新的问题一次。。。你能帮我一下吗?我的版式快出屏幕了。。。。我还提供了XML,您可以将LinearLayout(而不是CoordinatorLayout)作为您的根视图,并将方向添加为垂直方向,或者您可以从……获取文件……我认为这将帮助您……对我来说,它起到了作用。这也可能会在底部隐藏一些部分,然后将ViewPager放在滚动视图中。感谢它的工作,我怎么会错过这一点。。布局有问题谢谢你宝贵的时间。。。。还有宝贵的答案。。。。