I am new to android , so i was playing with activity,fragments and other stuff.
This is my end goal:
Current scenario:
Problem with this is that i have set my layout_width to match_parent so, now when the dialog comes up, it is setting itself according to wrap_content, so depending on the child sizes the dialog is getting set in width.
What i want is for the dialog to be full length; width wise.
What i tried: this answer
Basically i thought would override the theme and would add its width manually.
<style name="Theme.Transparent" parent="Theme.AppCompat.Light.Dialog">
        <item name="android:windowIsTranslucent">true</item>
        <item name="android:windowBackground">@android:color/transparent</item>
        <item name="android:windowContentOverlay">@null</item>
        <item name="android:windowNoTitle">true</item>
        <item name="android:width">@dimen/dialog_width</item>
        <item name="android:windowIsFloating">true</item>
        <item name="android:backgroundDimEnabled">true</item>
        <item name="colorPrimary">@color/colorPrimary</item>
        <item name="colorPrimaryDark">@color/colorPrimaryDark</item>
        <item name="colorAccent">@color/colorAccent</item>
        <item name="android:windowAnimationStyle">@android:style/Animation</item>
    </style>
dimens.xml
<dimen name="dialog_width">@dimen/match_parent</dimen>
attribs.xml
<resources>
    <item name="match_parent" type="dimen">-1</item>
    <item name="wrap_content" type="dimen">-2</item>
</resources>
This isn't working; it's making my app crash.
My xml:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:orientation="vertical"
    android:layout_width="match_parent" 
    android:layout_height="wrap_content"
    android:background="#ffff"
    android:id="@+id/dialogParent1">
    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:id="@+id/dialogParent2"
        android:orientation="horizontal">
        <ImageView
            android:layout_weight="1"
            android:contentDescription="@string/contains_song_thumbnail"
            android:layout_width="0dp"
            android:layout_height="40dp"
            android:id="@+id/dialogThumnbnail"
            android:layout_margin="10dp"
            android:background="@mipmap/ic_music_note_black_24dp"
            />
        <TextView
            android:layout_weight="6"
            android:layout_width="0dp"
            android:layout_height="match_parent"
            android:gravity="center"
            android:id="@+id/dialogTextview"
            android:scrollHorizontally="true"
            android:freezesText="true"
            android:ellipsize="marquee"
            android:marqueeRepeatLimit="marquee_forever"
            android:focusableInTouchMode="true"
            />
        <ToggleButton
            android:layout_weight="1"
            android:layout_width="0dp"
            android:layout_height="wrap_content"
            android:text=""
            android:textOff=""
            android:layout_margin="5dp"
            android:id="@+id/dialogControl"
            android:background="@drawable/ic_play_pause_small"
            android:textOn="" />
    </LinearLayout>
    <android.support.v4.widget.Space
        android:layout_width="match_parent"
        android:layout_height="20dp" />
    <LinearLayout
        android:layout_width="match_parent"
        android:orientation="horizontal"
        android:layout_height="wrap_content">
        <SeekBar
            android:id="@+id/dialogSeekbar"
            android:layout_width="0dp"
            android:layout_weight="4"
            android:layout_height="wrap_content"
            />
        <TextView
            android:layout_weight="1"
            android:layout_width="0dp"
            android:layout_height="wrap_content"
            android:text="@string/app_name"
            android:textSize="10sp"
            android:textStyle="bold"
            android:gravity="center"
            />
    </LinearLayout>
    <android.support.v4.widget.Space
        android:layout_width="match_parent"
        android:layout_height="20dp" />
Question is how do i make the size fix and how do i customize my dialog theme to set properly ?
P.s: this is not dialog but its an activity, i have just used the dialog theme on it.



 
    