karthik
karthik

Reputation: 219

How to remove ImageView alignment programmatically?

<ImageView 
        android:id="@+id/wipeID"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_above="@+id/popup_window"
        android:layout_alignBottom="@+id/linerID"
        android:src="@drawable/wiper_btn"/>

In the above one android:layout_alignBottom="@+id/linerID" is remove programmatically how to remove that one?

Upvotes: 0

Views: 226

Answers (2)

micnubinub
micnubinub

Reputation: 126

Try using this : imageView.setBaselineAlignBottom(false);

Upvotes: 0

codewing
codewing

Reputation: 712

If I don't get you wrong you want to change your layout parameters...

So this is roughly how you can achive it:

  1. get your imageview with findViewById(...)
  2. get the layout parameters somehow like this: LinearLayout.LayoutParams params = ( LinearLayout.LayoutParams) imageView.getLayoutParams();
  3. change them by setting the values you want: params.setMargins(newX, newY, 0, 0); //for margins imageView.setLayoutParams(params); if this does not work (param for align bottom does not exist) you can add rules: this could help or google something like "android add rule layout param"

hope this leads you to the right track...

Upvotes: 1

Related Questions