Q:

Modifying multiple views with same id

I have a view whose purpose is to draw a horizontal line (section delimiter). 
<View
    android:id="@id/ViewHorizontalLine"
    android:layout_width="fill_parent"
    android:layout_height="2dip"
    android:background="@color/ColorGrey" />

I have a number of those in my fragment, and wish to modify all of them programmatically in one go. I don't want to create an individual id for each since I'll be doing the same operations on each of them:
int margin = 4; // these are random pixel numbers
ViewGroup.MarginLayoutParams params = (ViewGroup.MarginLayoutParams) mViewHorizontalLine.getLayoutParams();
params.topMargin = margin;
params.bottomMargin = margin;
params.height = 8;

I tried creating a ids.xml as suggested by Android Studio for my @id/ViewHorizontalLine but my code is only affecting the first View. Is there a way to affect multiple views with the same ID?
If not, what is the best way to modify multiple views in the same way, programmatically?

A:

If you want web styling .class functionality in Android, you must define and style. For instance:
res/styles.xml
<style name="ViewStyle">
    <item name="android:layout_margin">16dp</item>
    <item name="android:layout_width">match_parent</item>
    <item name="android:layout_height">wrap_content</item>
    <item name="android:background">#000</item>
</style>

Then, in your layout style as many views you want with the same style, but with diferent IDs:
your_activity_layout.xml
<View
    android:id="@+id/ViewHorizontalLine1"
    style="@style/ViewStyle"/>
<View
    android:id="@+id/ViewHorizontalLine2"
    style="@style/ViewStyle"/>
<View
    android:id="@+id/ViewHorizontalLine3"
    style="@style/ViewStyle"/>

