Question: There are a activity what I want to fill the screen in a phone
and pop up(dialog) for a tablet.

I thought I make a layout file like this, 

```
<LinearLayout
  xmlns:android="http://schemas.android.com/apk/res/android"
  android:orientation="vertical"
  android:layout_width="@dimen/main_layout_width"
  android:layout_height="match_parent">

```

and externalize the value of width as

in values/dimens.xml

```
<dimen name="tutorial_width">match_parent</dimen>

```

in values-xlarge/dimens.xml

```
<dimen name="tutorial_width">320dp</dimen>

```

But I can't representation 'match\_parent' as dimen element.
Any help? Thanks!

Answer: 
Whats works for me and probably features academic correctness is something like this:

```
<!-- In values/dimens.xml -->
<item name="width_match_unless_huge" type="dimen" format="integer">-1</item>

<!-- In values-sw600dp/dimens.xml -->
<item name="width_match_unless_huge" type="dimen" format="dimension">600dp</item>

```

This allows you to mix sizing behavior constants like `MATCH_PARENT` and concrete sizes in **dp** depending on the current configuration.

You would use it as a regular `<dimen/>`:

```
<LinearLayout
    android:layout_width="@dimen/width_match_unless_huge"
    .../>

```
Value -1 was not working for me on android api 30 emulator of Pixel 4.

Clean solution is to define `sw600dp/styles.xml` and create base style for your component in styles f.e. `DialogControllerTypeGridBase` then create other that ha its as parent `DialogControllerTypeGrid` and also other in sw600dp.

Example:

styles.xml

```
<style name="DialogControllerTypeGridBase" parent="CSGridMatch">
    <item name="android:layout_height">wrap_content</item>
    <item name="android:background">@drawable/background_bordered_section</item>
    <item name="android:horizontalSpacing">8dp</item>
    <item name="android:padding">4dp</item>
    <item name="android:verticalSpacing">8dp</item>
</style>

<style name="DialogControllerTypeGrid" parent="DialogControllerTypeGridBase">
    <item name="android:layout_width">wrap_content</item>
    <item name="android:numColumns">6</item>
</style>

```

sw600dp/styles.xml

```
 <style name="DialogControllerTypeGrid" parent="DialogControllerTypeGridBase">
        <item name="android:layout_width">450dp</item>
        <item name="android:numColumns">3</item>
 </style>

```

This way nothing gets duplicated and you dont use meaningles values like -1, -2 that dont work reliably across device based not just by me but also comments from others.