Search code examples
androidandroid-titlebar

How to remove the title name and app icon from the appication UI?


remove app icon and tile

I want to use my own title.I think app icon and application name automatically comes while installing the app.I have made my own customized image and i want to use it as title.I have used the below code but it is not working for me

public class MainActivity extends Activity {


@Override
protected void onCreate(Bundle savedInstanceState)
{
    // TODO Auto-generated method stub
    super.onCreate(savedInstanceState);
     setContentView(R.layout.homescreen);
     getWindow().setFeatureInt(Window.FEATURE_CUSTOM_TITLE, R.layout.titlebar);


}

}

titlebar.xml

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:background="@drawable/titlebar"
    android:orientation="horizontal" >
     <View
        android:layout_width="0dp"
        android:layout_height="0dp"
        android:layout_weight="1" />


</LinearLayout>

Solution

  • Use below code in your activity to remove the default title

    protected void onCreate(Bundle savedInstanceState) {
            super.onCreate(savedInstanceState);
            this.requestWindowFeature(Window.FEATURE_NO_TITLE);
            setContentView(R.layout.activity_name);
    }
    

    and in your xml create your own custom title using linearlayout having textview and ImageView