SoFunction
Updated on 2025-04-10

Detailed explanation of Android application and code implementation

The wonderful use

To Android is like css to JSP

magical effect

<?xml version="1.0" encoding="utf-8"?> 
<LinearLayout xmlns:andro 
  android:layout_width="match_parent" 
  android:layout_height="match_parent" 
  android:orientation="vertical" > 

  <TextView 
    android: 
    android:layout_width="match_parent" 
    android:layout_height="match_parent" /> 

</LinearLayout> 

Such layout files are normal. But it's better

<?xml version="1.0" encoding="utf-8"?> 
<LinearLayout xmlns:andro 
  style="@style/all_match" 
  android:orientation="vertical" > 

  <TextView 
    android: 
    style="@style/all_fill" /> 

</LinearLayout> 

Save time and effort, you can see what layout method is at a glance. Just add these codes in

<style name="all_fill" > 
    <item name="android:layout_width">fill_parent</item> 
    <item name="android:layout_height">fill_parent</item> 
  </style> 
  <style name="all_match" > 
    <item name="android:layout_width">match_content</item> 
    <item name="android:layout_height">match_content</item> 
  </style> 
  <style name="width_fill" > 
    <item name="android:layout_width">fill_parent</item> 
    <item name="android:layout_height">match_content</item> 
  </style> 
  <style name="height_fill" > 
    <item name="android:layout_width">match_content</item> 
    <item name="android:layout_height">fill_parent</item> 
  </style> 

Thank you for reading, I hope it can help you. Thank you for your support for this site!