I have a couple of textswitcher's that are very similar so I wanted to 
reuse them (the same with a TextField, but I gonna use the textswitcher as 
example). The views are being used in a RelativeLayout. 

The textswitcher is defined in a separate xml file: 

<TextSwitcher xmlns:android="http://schemas.android.com/apk/res/android";
    android:layout_width="wrap_content"
    android:layout_height="wrap_content" >
</TextSwitcher>


and then I would include it as: 

<include android:id="@+id/test" 
android:layout_toRightOf="@id/hoursMinutesSeparatorTextField" 
layout="@layout/clock_visual"/>


If needed the whole mainactivity: 

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android";
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:padding="10dp">

    <TextSwitcher
        android:id="@+id/hoursTextSwitcher"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignParentLeft="true"
        android:layout_alignParentTop="true">
    </TextSwitcher>

    <TextView 
        android:id="@+id/hoursMinutesSeparatorTextField"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text=":"
        android:layout_toRightOf="@id/hoursTextSwitcher"
        android:textSize="36dp" >
    </TextView>

    <include android:id="@+id/test" 
android:layout_toRightOf="@id/hoursMinutesSeparatorTextField" 
layout="@layout/clock_visual"/>
        
</RelativeLayout>



A tutorial said that you can override every android:layout_* attribute in 
the include tag. So I want to reuse the textswitcher a couple of times, and 
as such the id and the android:layout_toRightOf will change so I override 
it.
Now the weird thing is that it doesn't override the 
android:layout_toRightOf part. It does however work with the id. And when I 
for example do the same but with the following textswitcher: 

<TextSwitcher xmlns:android="http://schemas.android.com/apk/res/android";
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_toRightOf="@id/hoursMinutesSeparatorTextField" >
</TextSwitcher>


Than it still doesn't override but it will lay the component out 
accordingly but always to the hoursTextSwitcher instead of the one I 
defined in my input tag.
So is it normal that the android:layout_toRightOf doesn't get overriden? 
And if so is there another way to reuse this component? 

Remark: I know this question has already been posted @ 
http://androidforums.com/developer-101/615194-input-tag-doesnt-override-android-layout_torightof.html,
 
but there hasn't been a response as of yet. Maybe I'll get a response here, 
since this is an official group. I hope someone can clarify if this is 
normal or not. If an answer/solution is given, I'll update the other 
forum/group.

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to