Margin-problem with changed layout for titlebar

by $搂Kalle搂$ » Thu, 12 Feb 2009 04:11:21 GMT


Sponsored Links
 I am using the following Layout for the titlebar with a blue backround
color

<RelativeLayout
        android:id="@+id/RelativeLayout01"
        xmlns:android=" http://schemas.android.com/apk/res/android" ;
        android:layout_width="fill_parent"
        android:layout_height="fill_parent"
        android:background="#ff000099">
        <TextView
                android:id="@+id/TextView01"
                android:layout_height="wrap_content"
                android:text="@string/app_name"
                android:textColor="#ffffffff"
                android:textStyle="bold"
                android:gravity="center_vertical"
                android:layout_centerVertical="true"
                android:layout_width="wrap_content">
        </TextView>
</RelativeLayout>

In onCreate I got:
...
        requestWindowFeature(Window.FEATURE_CUSTOM_TITLE);
        setContentView(R.layout.main);
        getWindow().setFeatureInt(Window.FEATURE_CUSTOM_TITLE,
R.layout.title);
...

With that I get a changed titlebar for my HelloWorlApp, that is fine.
But somehow on the left and right side there is some margin and I
still can see some Grey from the original titlebar.

What did I wrong?

KalLe
--~--~---------~--~----~------------~-------~--~----~



Margin-problem with changed layout for titlebar

by $搂Kalle搂$ » Sat, 14 Feb 2009 17:03:22 GMT


 I uploaded a screenshot, which shows the problem, I have with the
changed titlebar

 http://hphone.eu/Android/Titlebar.html 

KalLe



--~--~---------~--~----~------------~-------~--~----~


Sponsored Links


Margin-problem with changed layout for titlebar

by $搂Kalle搂$ » Sun, 15 Feb 2009 08:44:40 GMT


 on't worry. I will not try to make my apps like Windows x.x. I just
want to understand the changebale titlebar for the moment ;-)

Here is the complete layout, which fits to the scrrenshot I mentioned.
I do not think, that the icons caused the problem.

######################
<?xml version="1.0" encoding="utf-8" ?>

<RelativeLayout
android:id="@+id/RelativeLayout01"
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:background="#ff000099">
<TextView
android:id="@+id/TextView01"
android:layout_height="wrap_content"
android:text="@string/app_name"
android:textColor="#ffffffff"
android:textStyle="bold"
android:gravity="center_vertical"
android:layout_centerVertical="true"
android:layout_width="wrap_content" />
<AbsoluteLayout
android:id="@+id/AbsoluteLayout01"
android:layout_width="fill_parent"
android:layout_toRightOf="@+id/TextView01"
android:layout_height="fill_parent">
<LinearLayout android:id="@+id/LinearLayout01"
android:gravity="right"
android:layout_width="fill_parent"
android:layout_height="fill_parent">
<ImageButton
android:id="@+id/ImageButton01"

android:layout_width="wrap_content"

android:layout_height="wrap_content"

android:layout_gravity="center_vertical"

android:layout_marginRight="20dip"
android:clickable="true"

android:background="@drawable/us" />
<ImageButton
android:id="@+id/ImageButton02"

android:layout_width="wrap_content"

android:layout_height="wrap_content"

android:layout_gravity="center_vertical"

android:layout_marginRight="20dip"
android:clickable="true"

android:background="@drawable/es" />
<ImageButton
android:id="@+id/ImageButton03"

android:layout_width="wrap_content"



Margin-problem with changed layout for titlebar

by elDoudou » Fri, 10 Apr 2009 23:26:17 GMT


 If you take a look at the hierarchy viewer, you will notice that the
customized title is contained in a FrameLayout with id
"title_container", which has a left and right padding set to 7. I
would be you, I'd try something like have a handle on your activity
root view, ask for its parent (a FrameLayout with id "content"), from
there ask this new view parent, i.e. a LinearLayout with no
identifier, and ask this view second child, which is the FrameLayout
responsible for setting the left and right passings: call the
setPadding() method on it, and see what happens.

This is really dirty, and I woul suggest to do as mentionned in the
previous post in your case! That was just meant to say that it might
be possible...

Hope that helps. Regards, douard
--~--~---------~--~----~------------~-------~--~----~



Margin-problem with changed layout for titlebar

by elDoudou » Mon, 13 Apr 2009 17:18:02 GMT


 As you are asking, please read 
 http://developer.android.com/guide/developing/tools/hierarchy-viewer.html 
for the explanations about the hierarchy viewer.
--~--~---------~--~----~------------~-------~--~----~



Other Threads

1. help with new class declaration

I added a new class to my Android project and then declared it in my
main .java file like this:

Encounter EncounterGenerator;

However, I'm getting this error:

"Encounter cannot be resolved to a type"

My new class is in a separate file with the code listed below.

Is there anything I'm doing wrong?

Thanks!

package myStuff.HelloAndroid;

public class EncounterGenerator {

        public String EncounterGenerator() {
                String encounterText;
                int encounter;
                encounter = (int)(Math.random() * 3);

                switch (encounter) {
                case 0:  encounterText = "Encounter # 1";
                                 break;
                case 1:  encounterText = "Encounter # 2";
                                 break;
                case 2:  encounterText = "Encounter # 3";
                                 break;
                default: encounterText = "Encounter # 4";
                }
                return encounterText;
        }
}

-- 

2. Android (GingerBread) compliance with AT&T requirements

Hello,

Just want to get some details about how shall i go about studying
Android (GingerBread) compliance with AT&T's device requirements
(ADAPT), if someone has carried out this study kindly share your
experience and inputs. Any pointers on this??


Regards
Sahil Gupta

-- 

3. Android: how to draw an ImageView with the same size regardless of device?

4. help with TextView

5. On CRC32, LVL and tamper-proof app

6. How to use Notification service from Broadcast receiver

7. How does one detect when an animation has finished?