Giter Club home page Giter Club logo

Comments (4)

JessYanCoding avatar JessYanCoding commented on August 17, 2024 9

@JiongBull 如果大部分是竖屏,只有一两个页面是横屏的话,可以使用代码 AutoSizeConfig#setDesignWidthInDp 随时都可以改变框架中设计图的宽高 。

如果是横竖屏都用的很多,用上面的代码切换起来就很频繁,但框架为副单位也增加了一套设计图尺寸,也就是框架支持设置两套设计图尺寸,manifest 中设置的是主单位的设计图尺寸,你可以使用 代码 为副单位设置另外一套设计图尺寸,这样你让竖屏页面使用主单位,让横屏页面使用副单位,就可以分开管理

from androidautosize.

CoenQian avatar CoenQian commented on August 17, 2024

Step 1 (真的不吹牛逼,只需要以下这一步,框架就可以对项目中的所有页面进行适配)
请在 AndroidManifest 中填写全局设计图尺寸 (单位 dp),如果使用副单位,则可以直接填写像素尺寸,不需要再将像素转化为 dp,详情请查看 demo-subunits

<manifest>
    <application>            
        <meta-data
            android:name="design_width_in_dp"
            android:value="360"/>
        <meta-data
            android:name="design_height_in_dp"
            android:value="640"/>           
     </application>           
</manifest>

如果你想布局在横屏时获得更好的适配效果,就只有让设计师针对横屏再出一套设计图 (针对横屏做单独适配这是基础吧,毕竟高和宽都完全不一样)

如果是 APP 有两种布局文件,一种横屏,一种竖屏,如何在 manifest 支持配置两种设计效果图的宽高呢?看 README 里只能配置一套宽高。

from androidautosize.

CoenQian avatar CoenQian commented on August 17, 2024

谢谢。

from androidautosize.

keaitao0321 avatar keaitao0321 commented on August 17, 2024

设计师对平板设计了两套UI(横屏和竖屏),我改如何使用框架进行适配,如何切换宽高适配呢?

from androidautosize.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.