2012-07-11 33 views
7

Tôi đã tìm kiếm SO nhưng không tìm thấy câu hỏi tương tự vì tôi không chắc chắn cách pha nó trong một câu. Tôi đang sử dụng ActionBarSherlock, có biểu trưng thay vì biểu tượng trình khởi chạy (tức là biểu tượng 72x72) có văn bản ở góc trên cùng của hoạt động.Ẩn biểu tượng trình chạy ứng dụng trong thanh tiêu đề khi hoạt động bắt đầu trong android

Khi hoạt động tải lần đầu tiên, trong một phần nhỏ của giây. Tôi thấy biểu tượng trình khởi chạy và nhãn được xác định trong tệp kê khai (như bên dưới), trước khi thanh tác vụ xuất hiện với biểu trưng. Hoạt động tại nhà này rất đơn giản, do đó, nó không thực hiện bất kỳ tải bổ sung nào có thể gây chậm trễ.

<application 
    android:hardwareAccelerated="true" 
    android:icon="@drawable/launcher_icon" 
    android:label="@string/app_name" 
    android:screenOrientation="portrait" > 

    <activity 
     android:name=".SplashScreenActivity" 
     android:label="@string/app_name" 
     android:logo="@drawable/ab_logo" 
     android:theme="@android:style/Theme.Light.NoTitleBar" > 
     <intent-filter> 
      <action android:name="android.intent.action.MAIN" /> 

      <category android:name="android.intent.category.LAUNCHER" /> 
     </intent-filter> 
    </activity> 

    <activity 
     android:name=".HomeActivity" 
     android:label="@string/homeitle" 
     android:logo="@drawable/ab_logo" 
     android:theme="@style/MyTheme" > 
    </activity> 

</application> 

Tôi có thể làm cho văn bản "biến mất" bằng cách tạo kiểu cho cùng màu với nền nhưng tôi không thể tìm cách xóa/ẩn biểu tượng trình khởi chạy khỏi hoạt động.

Tôi đã thiết lập hoạt động trên màn hình splash (như trong tệp kê khai ở trên), thao tác này chỉ tải hoạt động tại nhà của tôi nơi sự cố xảy ra. Điều này có ích, nhưng đôi khi vấn đề vẫn xảy ra khi tải hoạt động.

public class SplashScreenActivity extends Activity 
{ 
    @Override 
    public void onCreate(Bundle savedInstanceState) 
    { 
     super.onCreate(savedInstanceState); 
    } 

    @Override 
    public void onResume() 
    { 
     super.onResume(); 
     Intent i = new Intent(getBaseContext(), HomeActivity.class); 
     startActivity(i); 
     finish(); 
    } 
} 

Có ai biết một cách để ẩn nhãn tiêu đề launcher icon &, để nó không hiển thị lên trước ActionBarSherlock được hiển thị? Lý tưởng nhất là màn hình giật gân là không cần thiết, vì có một số cách để truy cập vào hoạt động mà sẽ tránh được màn hình hiển thị bên trên.

--- Cập nhật Theme tập tin của tôi ----

<style name="MyTheme" parent="Theme.Sherlock.ForceOverflow"> 
    <item name="android:windowBackground">@color/white</item> 
    <item name="android:actionBarStyle">@style/MyTheme.ActionBar</item> 
    <item name="android:actionMenuTextColor">@color/white</item> 
    <item name="actionBarStyle">@style/MyTheme.ActionBar</item> 
    <item name="actionMenuTextColor">@color/white</item> 
</style> 

<style name="MyTheme.ActionBar" parent="Widget.Sherlock.Light.ActionBar.Solid.Inverse"> 
    <item name="android:background">@color/blue</item> 
    <item name="android:titleTextStyle">@style/MyTheme.ActionBar.TitleTextStyle</item> 
    <item name="android:displayOptions">showHome|useLogo</item> 
    <item name="displayOptions">showHome|useLogo</item> 
    <item name="background">@color/blue</item> 
    <item name="titleTextStyle"> @style/MyTheme.ActionBar.TitleTextStyle</item> 
</style> 

<style name="MyTheme.ActionBar.TitleTextStyle" parent="@android:style/TextAppearance"> 
    <item name="android:textColor">@color/blue</item> 
</style> 

Trả lời

10

cố định nó bằng cách thêm biểu tượng cho phong cách, đó là giống như logo. Điều này sẽ ghi đè biểu tượng trình khởi chạy.

<style name="MyTheme.ActionBar" parent="Widget.Sherlock.Light.ActionBar.Solid.Inverse"> 
     <item name="android:background">@color/infostop_blue</item> 
     <item name="android:titleTextStyle">@style/MyTheme.ActionBar.TitleTextStyle</item> 
     <item name="android:displayOptions">showHome|useLogo</item> 
     <item name="displayOptions">showHome|useLogo</item> 
     <item name="android:icon">@drawable/ab_logo</item> 
     <item name="icon">@drawable/ab_logo</item> 
     <item name="background">@color/blue</item> 
     <item name="titleTextStyle"> @style/MyTheme.ActionBar.TitleTextStyle</item> 
    </style> 
+0

Rất khó để tìm câu hỏi của bạn và tôi vui vì tôi đã làm vì câu trả lời của bạn hoạt động. :) –

Các vấn đề liên quan