2016-04-06 25 views
0

I bir Android uygulama oluşturma edip sayfanın hava sayfası TabHost içine tutulur, böyle var:gizle işlem çubuğu Android Studio TabHost

Interface

MainActivity sınıfı:

public class MainActivity extends TabActivity { 

@Override 
protected void onCreate(Bundle savedInstanceState) { 
    super.onCreate(savedInstanceState); 

    //I used this but it's not working 
    requestWindowFeature(Window.FEATURE_NO_TITLE); 
    setContentView(R.layout.activity_main); 

    TabHost mTabHost = getTabHost(); 

    mTabHost.addTab(mTabHost.newTabSpec("first").setIndicator("First").setContent(
      new Intent(this, FirstActivity.class) 
    )); 
    mTabHost.addTab(mTabHost.newTabSpec("second").setIndicator("Second").setContent(
      new Intent(this, SecondActivity.class) 
    )); 
    mTabHost.setCurrentTab(0); 
} 

Ve SecondActivity hava içerir:

public class SecondActivity extends ActionBarActivity { 

@Override 
protected void onCreate(Bundle savedInstanceState) { 
    super.onCreate(savedInstanceState); 

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

    setContentView(R.layout.activity_weather); 

    if (savedInstanceState == null) { 
     getSupportFragmentManager().beginTransaction() 
       .add(R.id.container, new WeatherFragment()) 
       .commit(); 
    } 


} 

Sorun şu ki, <> eylem çubuğunu gizlemek istiyorum, çünkü bu gerçekten korkunç görünüyor. Gördüğünüz gibi, FEATURE_NO_TITLE isteğinde bulunmayı veya AndroidManifest'te android:theme="@style/Theme.AppCompat.NoActionBar"'u ayarlamayı yanı sıra FLAG_FULLSCREEN ayarlamayı denedim, ancak hiçbir şey iyi çalışmıyor.

(Ayrıca, hava durumu arabiriminin tam ekranını ayarlamak için yine de var mı? Kenarlar arasında küçük bir boşluk olduğu için) Yardımlarınız için teşekkürler.

cevap

0

Etkinliğinizde xml, appbarlayout adında bir düzen vardır, lütfen silecektir, işe yarayacaktır. Etkinliğimi xml

<?xml version="1.0" encoding="utf-8"?> 
<android.support.design.widget.CoordinatorLayout 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:layout_width="match_parent" 
    android:layout_height="match_parent" 
    android:fitsSystemWindows="true" 
    tools:context="com.ezybzy.ezybzy.Categorypage"> 

    <android.support.design.widget.AppBarLayout 
     android:layout_width="match_parent" 
     android:layout_height="wrap_content" 
     android:theme="@style/AppTheme.AppBarOverlay"> 

     <android.support.v7.widget.Toolbar 
      android:id="@+id/toolbar" 
      android:layout_width="match_parent" 
      android:layout_height="?attr/actionBarSize" 
      android:background="?attr/colorPrimary" 
      app:popupTheme="@style/AppTheme.PopupOverlay" /> 

    </android.support.design.widget.AppBarLayout> 

    <include layout="@layout/content_categorypage" /> 

</android.support.design.widget.CoordinatorLayout> 

lütfen değiştirin bu

<?xml version="1.0" encoding="utf-8"?> 
<android.support.design.widget.CoordinatorLayout 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:layout_width="match_parent" 
    android:layout_height="match_parent" 
    android:fitsSystemWindows="true" 
    tools:context="com.ezybzy.ezybzy.Categorypage"> 



    <include layout="@layout/content_categorypage" /> 

</android.support.design.widget.CoordinatorLayout> 

bu boş etkinlik oluşturmak yalnızca çalışacaktır !!

+0

Çalışmıyordum, bunun yerine boş bir etkinlik oluşturdum, dolayısıyla xml :(’de '

İlgili konular