I am making an application like whatsup. My question is about the interface. I can get the desc message and analyze it. After that, I can add the layout programmatically, but it writes the same coordinate all the time. I tried tv.layout(l, t, r, b) and tv.setTop but did not work.
Where is my problem?
bubbleLayout=(RelativeLayout)findViewById(R.id.layoutbubble); for(int i=0;i<msgid.length;i++){ RelativeLayout relativeLayout = new RelativeLayout(this); RelativeLayout.LayoutParams rlp = new RelativeLayout.LayoutParams( RelativeLayout.LayoutParams.FILL_PARENT, RelativeLayout.LayoutParams.FILL_PARENT);
My xml file:
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="fill_parent" android:orientation="vertical" > <RelativeLayout android:layout_width="1300dip" android:layout_height="80dip" android:background="#084B8A" > <TextView android:id="@+id/messagetitle" android:layout_width="wrap_content" android:layout_height="90dip" android:layout_centerInParent="true" android:layout_marginTop="30dip" android:textColor="#ffffff" android:textSize="12pt" /> </RelativeLayout> <RelativeLayout android:id="@+id/layoutbubble" android:layout_width="1300dip" android:layout_height="500dip" android:layout_marginTop="10dip" > </RelativeLayout> <RelativeLayout android:layout_width="1300dip" android:layout_height="80dip" android:layout_marginTop="10dip" > <EditText android:id="@+id/replytext" android:layout_width="1000dip" android:layout_height="90dip" android:layout_marginLeft="10dip" /> <Button android:id="@+id/sendbutton" android:layout_width="200dip" android:layout_height="90dip" android:layout_marginLeft="1050dp" android:background="#084B8A" android:text="Send" android:textColor="#ffffff" android:textSize="12pt" /> </RelativeLayout> </LinearLayout>
Screen shot

source share