I have the following xml file:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout android:enabled="false" android:orientation="horizontal" android:id="@id/action_container"
android:background="@null" android:paddingLeft="4.0dip" android:layout_width="0.0dip"
android:layout_height="48.0dip" android:layout_weight="1.0"
style="@style/Widget.Compat.NotificationActionContainer"
xmlns:android="http://schemas.android.com/apk/res/android">
<ImageView android:enabled="false" android:layout_gravity="start|center" android:id="@id/action_image"
android:layout_width="@dimen/notification_action_icon_size"
android:layout_height="@dimen/notification_action_icon_size" android:scaleType="centerInside"
android:alpha="0.5"/>
<TextView android:enabled="false" android:textColor="#ffcccccc"
android:ellipsize="end"
android:layout_gravity="start|center"
android:id="@id/action_text" android:paddingLeft="4.0dip"
android:clickable="false" android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:singleLine="true" android:alpha="0.5"
style="@style/Widget.Compat.NotificationActionText"/>
</LinearLayout>
I'm trying to remove the extra spaces and line breaks.
This is the result i need:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout android:enabled="false" android:orientation="horizontal" android:id="@id/action_container" android:background="@null" android:paddingLeft="4.0dip" android:layout_width="0.0dip" android:layout_height="48.0dip" android:layout_weight="1.0" style="@style/Widget.Compat.NotificationActionContainer" xmlns:android="http://schemas.android.com/apk/res/android">
<ImageView android:enabled="false" android:layout_gravity="start|center" android:id="@id/action_image" android:layout_width="@dimen/notification_action_icon_size" android:layout_height="@dimen/notification_action_icon_size" android:scaleType="centerInside" android:alpha="0.5"/>
<TextView android:enabled="false" android:textColor="#ffcccccc" android:ellipsize="end" android:layout_gravity="start|center" android:id="@id/action_text" android:paddingLeft="4.0dip" android:clickable="false" android:layout_width="wrap_content" android:layout_height="wrap_content" android:singleLine="true" android:alpha="0.5" style="@style/Widget.Compat.NotificationActionText"/>
</LinearLayout>
I tried using this command
sed -i '' 's/^[ \t]*//;s/[ \t]*$//' file.xml
It removed some spaces, but didn't remove the line breaks.
Eventually i want to be able to change for example the ImageView's width (android:layout_width) to 5dip by knowing only its id(@id/action_image).
i want to be able to get an xml element by it's id and change the value of it's other parameters