Still a total noob here...
I'm trying to render the specs for a football match (teams, time, tournament etc.)
I have created a team.xml:
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="wrap_content"
android:layout_height="wrap_content" >
<ImageView
android:id="@+id/teamImageView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginRight="2dp"
android:adjustViewBounds="true"
android:src="@drawable/sofabold_launcher"
android:layout_alignWithParentIfMissing="false"
android:clickable="false"
android:cropToPadding="true"
android:contentDescription="@string/teamLogoContentDescription"/>
<TextView
android:id="@id/teamName"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/teamName"
android:textSize="14sp"
android:textStyle="bold"
android:layout_centerVertical="true"
android:layout_toRightOf="@+id/teamImageView"/>
</RelativeLayout>
A teams.xml:
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="bottom"
android:orientation="vertical" >
<include
android:layout_width="wrap_content"
android:layout_height="wrap_content"
layout="@layout/team"
android:layout_alignParentTop="true"
android:layout_alignParentLeft="true"
android:id="@+id/homeTeam"/>
<include
android:layout_width="wrap_content"
android:layout_height="wrap_content"
layout="@layout/team"
android:layout_below="@id/homeTeam"
android:id="@+id/awayTeam"/>
</RelativeLayout>
And then I have a matchLayout.xml including my teams.xml
My initial attempt was to just create one big layout with different element and reference them all by their id in my matchHolder and populating them using something like
matchHolder.homeTeamName.setText(match.getHomeTeamName());
Now I've tried changing my populateMatchHolder to:
private void populateMatchHolder(View convertView, BaseMatchHolder matchHolder) {
matchHolder.teams = (RelativeLayout) convertView.findViewById(R.id.teams);
}
and now I cant figure out how to reference the TextView (home team name) inside the RelativeLayout (teams) inside another RelativeLayout (match).
Am I totally missing the point here? Do I need to have an id called homeTeamName somewhere? And awayTeamName? Isn't it just enough to have teamName twice? Once in the homeTeam include of team.xml and once in the awayTeam include of team.xml.
Hope it's somewhat clear what I mean :-) It's pretty late and I'm tired :-/
Thanks in advance