Hello currently I'm making my custom ListAdapter and I add my Text
Views the following way:
LinearLayout.LayoutParams radioParams = new LinearLayout.LayoutParams
(320, LayoutParams.FILL_PARENT);
radioParams.setMargins(1, 1, 1, 1);
TextView stationName = new TextView( context );
stationName.setText( radioInfo.getStationName() );
stationName.setTextSize(14f);
stationName.setTextColor(Color.WHITE);
addView( stationName, radioParams);
I already have a layout that I want to use for each element
essentially would be nice if I could just call something like:
setContentView(R.layout.station_list_element);
or
LinearLayout radioParams = new LinearLayout(context,
R.layout.station_list_element );
radioParams.textNowPlaying= "Chemical Brothers"
So that for sure that won't work but how can I create a LinearLayout
and import my settings which are on my xml? Then how could I access
the individual fields to update the text on them?
Thanks!
here is my "station_list_element.xml"
<LinearLayout android:id="@+id/MainLayout"
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<TextView android:id="@+id/textNowPlaying"
xmlns:android="http://schemas.android.com/apk/res/android"
android:text="Katy Perry"
android:textStyle="bold"
android:textColor="#ffffff"
android:textSize="20sp"
android:layout_marginLeft="8px"
android:layout_marginTop="5px"
android:layout_width="fill_parent"
android:layout_height="wrap_content"/>
<TextView android:id="@+id/textNowPlaying2"
xmlns:android="http://schemas.android.com/apk/res/android"
android:text="I kissed a girl"
android:textStyle="bold"
android:textColor="#ffffff"
android:textSize="20sp"
android:layout_marginLeft="8px"
android:layout_marginTop="5px"
android:layout_width="fill_parent"
android:layout_height="wrap_content"/>
</LinearLayout>
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~----------~----~----~----~------~----~------~--~---