Hi all,
<RelativeLayout android:orientation="horizontal"
android:layout_width="wrap_content"
android:layout_height="wrap_content">
<ImageView
android:id="@+id/discover"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_alignParentBottom="true"
android:layout_marginLeft="30dp"
android:layout_marginBottom="20dp"
android:src="@drawable/discover"/>
<ImageView
android:id="@+id/scan"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_alignParentBottom="true"
android:layout_marginRight="30dp"
android:layout_marginBottom="20dp"
android:src="@drawable/scanner"/>
</RelativeLayout>
From the above xml code,i can position the two imageview on same line at
the bottom of the layout.when i set the margins dynamically through
program,there exists only one imageview at the top of the layout.Here is my
program
discoverDevice=(ImageView)findViewById(R.id.discover);
cardScanner=(ImageView)findViewById(R.id.scan);
float
margin=TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP,20,getResources().getDisplayMetrics());
RelativeLayout.LayoutParams drelativeLayout=new
RelativeLayout.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT,ViewGroup.LayoutParams.WRAP_CONTENT);
RelativeLayout.LayoutParams crelativeLayout=new
RelativeLayout.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT,ViewGroup.LayoutParams.WRAP_CONTENT);
drelativeLayout.setMargins((int)margin,0,0,(int)margin);
crelativeLayout.setMargins(0,0,(int)margin,(int)margin);
discoverDevice.setLayoutParams(drelativeLayout);
cardScanner.setLayoutParams(crelativeLayout);
--
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