I have a relative layout
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content" >
<ImageView
android:id="@+id/ivLogo"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_alignParentTop="true"
android:src="@drawable/ic_launcher" />
<Button
android:id="@+id/b2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_alignParentTop="true"
android:text="Button" />
<Button
android:id="@+id/b1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentTop="true"
android:layout_toLeftOf="@+id/b2"
android:text="Button" />
<TextView
android:id="@+id/tvName"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:layout_marginLeft="21dp"
android:layout_toRightOf="@+id/ivLogo"
android:text="Large Text"
android:textAppearance="?android:attr/textAppearanceLarge" />
</RelativeLayout>
which contains an imageview, textview, and two buttons, and what I want is to make a list of a info to be filled in this layout auto .. umm, like making in the java file “Heart.png”, heart, http://www.heart.com, 69552874 .. then when I start the app the info I typed in the java class gets in the activity .. the “heart.png” gets in the ivLogo imageview, and the http://www.heart.com gets into b1 button, like this ..
I can achieve what i want using the xml but it will take a long of time and it’ll be very slow because ill be many imageviews .. I want to make a list of things with their logo and name and num. and website , like can the java make a new relative layout for every info ..
like if i write
"Heart.png", heart1, www.heart.com, 69552874
"Heart.png", heart2, www.heart.com, 69552874
"Heart.png", heart3, www.heart.com, 69552874
I see in the app 3 relative layouts for each heart 1,2, and 3 ..
I want a method to do that not using the xml for each one make a new relative layout
isn’t there something like makenewLayout etc … ?
sorry for taking long, a two words hint will be nice to me <3
Yes, you can do this in code.
Put this in a function, and call the function for various images, textviews, etc.