vue折叠面板默认折叠


We built the Android Emulator to make it possible for you to test your app without having to maintain a fleet of physical devices. While this is still our primary goal, we’re not satisfied with providing a tool that is exclusively an imitation of a physical device. Instead, we want to build an emulator that complements physical devices by providing features that are only made possible by a virtual device.

我们构建了Android模拟器,使您无需维护大量物理设备即可测试您的应用程序。 尽管这仍然是我们的主要目标,但我们对提供专门模仿物理设备的工具并不满意。 相反,我们希望通过提供只能由虚拟设备实现的功能来构建对物理设备进行补充的仿真器。

In the past, we’ve released features like the Location and Battery extended controls, both of which allow you to quickly test scenarios that would cause headaches on a physical device. The Location controls allow you to test your app’s reaction to movement along a route from the comfort of your desk, and the Battery controls allow you to test the impact of things like charge level state without having to wait for your physical device’s battery to run down.

过去,我们发布了“ 位置”和“电池”扩展控件之类的功能 ,这两项功能都使您能够快速测试可能导致物理设备头痛的情况。 位置控件可让您从舒适的桌子上测试应用对沿路线移动的React,而电池控件可让您测试充电水平状态等事物的影响,而不必等待物理设备的电池耗尽。




The Location controls allow you to emulate movement along a route. 位置控件可让您模拟沿路线的移动。

Today, I’d like to show you some of the new ways the Android Emulator is making it easier to develop and test your app, with a particular focus on functionality that aligns with new features in Android 11.

今天,我想向您展示Android模拟器使开发和测试应用程序变得更加容易的一些新方法,特别着重于与Android 11中的新功能保持一致的功能。

(Foldables and other form factors)

Unlocking the potential of foldable phones just got easier with Android Emulator version 30.0.23+, which can be found in the Android Studio Canary release channel. It features a new 3D foldable device rendering and expanded foldable controls. The 3D rendering makes it straightforward to visualize how your app will look on a foldable device, while the expanded controls allow you to explicitly set the angle of each fold or the overall device posture. You can use these additions to validate that your app looks great on foldable devices and build custom experiences that play off of the form factor’s strengths.

使用Android Emulator 30.0.23+版本可以更轻松地释放可折叠手机的潜力,该版本可在Android Studio Canary发布频道中找到。 它具有新的3D可折叠设备渲染和扩展的可折叠控件。 通过3D渲染,可以直观地直观显示您的应用在可折叠设备上的外观,而展开的控件可让您显式设置每次折叠的角度或整个设备的姿势。 您可以使用这些添加项来验证您的应用在可折叠设备上的外观是否不错,并构建可发挥外形优势的自定义体验。


Using the Emulator to build an interface that splits into a parent child layout when the device’s state is HALF_OPENED and returns to normal when the state is OPENED . 使用仿真器来构建一个接口,该接口在设备状态为 HALF_OPENED 时拆分为父子布局, 并在状态为 OPENED 时返回正常

This feature takes advantage of the flexibility of the Android Emulator and hooks directly into the WindowManager, a recent addition to Android Jetpack that makes it possible for developers to build consistent experiences that react to the posture of foldable devices. With these controls, you can explicitly set the WindowManager’s DeviceState and test your app’s reaction. In the example above, the Android Sunflower sample app has been modified to split into a parent child layout along the device’s hinge when the posture is HALF_OPENED, using the hardware to support novel UX. If you want to learn more about this library and building for foldables, read Building apps for foldables or Support New Form Factors with the New Jetpack WindowManager Library. If that’s not enough, look out for more content in the 9th week of 11 Weeks of Android: Android Beyond Phones.

此功能利用了Android Emulator的灵活性,并直接与WindowManager挂钩, WindowManagerAndroid Jetpack的最新功能 ,使开发人员可以构建对可折叠设备的姿势有React的一致体验。 使用这些控件,您可以显式设置WindowManager的DeviceState并测试您的应用程序的React。 在上面的示例中,对Android Sunflower示例应用程序进行了修改,以在姿势为HALF_OPENED时使用设备支持新的UX沿设备的铰链拆分成父子布局。 如果要了解有关此库并为可折叠设备构建的更多信息,请阅读为可折叠设备构建应用程序,使用新的Jetpack WindowManager库支持新的外形尺寸 。 如果这还不够,请在“ Android 11周:Android超越手机”的第9周中寻找更多内容。

Alongside the visualization and extended controls, we are expanding upon the two initial foldable hardware profiles and will be releasing profiles that feature horizontal folds and dual displays alongside Android Studio 4.2. Until then, or afterwards if you would like to customize your virtual device, foldable properties can be added or modified by editing a virtual device’s config.ini file. This makes it possible to emulate any foldable device on the market or even configurations that don’t yet exist. A virtual device’s config.ini file can be found by right clicking the device in the Android Virtual Device (AVD) Manager in Android Studio and selecting “Show on Disk”. Adding the following code to a Pixel 3’s config.ini file allows you to see what it would look like with a horizontal fold!

除了可视化和扩展控件外,我们还将扩展两个初始的可折叠硬件配置文件 ,并将发布具有水平折叠和双重显示功能的配置文件以及Android Studio 4.2。 在此之前或之后,如果您想自定义虚拟设备,可以通过编辑虚拟设备的config.ini文件来添加或修改可折叠属性。 这样就可以模拟市场上任何可折叠的设备,甚至还可以模拟尚不存在的配置。 可以通过在Android Studio中的Android虚拟设备(AVD)管理器中右键单击该设备,然后选择“在磁盘上显示”来找到虚拟设备的config.ini文件。 将以下代码添加到Pixel 3的config.ini文件中,您可以水平折叠看到它的外观!

hw.sensor.hinge = yes


# Number of hinges
hw.sensor.hinge.count = 1


# 0 = horizontal, 1 = vertical
hw.sensor.hinge.type = 0


# Min and max angle of each hinge. Add a comma and repeat for additional hinges.
hw.sensor.hinge.ranges = 0-180


# The angle of each hinge at boot. Add a comma and repeat for additional hinges.
hw.sensor.hinge.defaults = 180


# Starting x, starting y, width, height. Add a comma and repeat for additional hinges.
hw.sensor.hinge.areas = 0-1080-1080-1


# 1 = closed, 2 = half-opened, 3 = opened, 4 = flipped
hw.sensor.posture_list = 1,2,3


# Assigning boundaries between the postures, usually implemented by OEMs
# Add an & and an additional range when multiple hinges determine posture (0-30&0-30)
hw.sensor.hinge_angles_posture_definitions = 0-30, 30-150, 150-180


A virtual Pixel 3 with an added horizontal fold. 具有水平折叠的虚拟像素3。

Keep in mind that foldables are only one of many alternative form factors supported by Android and the Android Emulator. Our Android Auto, Android TV, and WearOS virtual devices also make it possible to build for alternative form factors and reach even more users.

请记住,可折叠只是Android和Android Emulator支持的许多替代形式之一。 我们的Android AutoAndroid TVWearOS虚拟设备还可以构建替代尺寸的产品,并吸引更多用户。

(5G)

The Android Emulator now features 5G support, allowing you to develop experiences that leverage 5G without having to purchase hardware or access a physical 5G network. To try this out, download and create a virtual device with one of the Android 11 Beta 2+ (API level 30) system images and run it with the latest version of the Android Emulator, which is available in the Android Studio Canary release channel.

Android Emulator现在具有5G支持,使您无需购买硬件或访问物理5G网络即可开发利用5G的体验。 要尝试此操作,请下载并使用Android 11 Beta 2+(API级别30)系统映像之一创建虚拟设备,然后使用最新版本的Android Emulator运行该设备,该软件可在Android Studio Canary发布频道中找到。

The Android Emulator 5G network setting integrates with the new Android 11 5G detection, meteredness, and bandwidth estimation APIs, making it possible to develop for and test against this API surface with the click of a button.

Android Emulator 5G网络设置与新的Android 11 5G检测计量带宽估计 API集成在一起, 只需单击一下按钮,即可针对该API表面进行开发和测试。


The 5G network setting can be accessed in the Android Emulator’s Cellular controls 可以在Android模拟器的Cellular控件中访问5G网络设置

Check out our 5G documentation to learn more about adding 5G capabilities to your app.

查看我们的5G文档,以了解有关向您的应用程序添加5G功能的更多信息。

(Conclusion & Looking Forward)

The Android Emulator was initially built to provide a realistic virtual device that makes it possible to test your app on every device configuration out there without having to upkeep a fleet of physical devices. We are still committed to this goal and will continue to provide a variety of device form factors alongside high quality, Android Compatibility Test Suite (CTS) compliant system images for each Android platform release.

Android模拟器最初是为了提供逼真的虚拟设备而构建的,该虚拟设备使您可以在无需维护大量物理设备的情况下,在每种设备配置上测试您的应用程序。 我们仍然致力于实现这一目标,并将继续为每个Android平台版本提供各种设备尺寸以及高质量, 兼容Android兼容性测试套件(CTS)的系统映像。

That said, we aren’t satisfied with just providing the basic feature set of a physical device. Instead, we are also focused on building a tool that goes above and beyond, complementing physical devices with features that are only possible on a virtual device. The new Android Emulator foldable and 5G features are two examples of how the Android Emulator complements physical devices, and we hope that they help turn your app up to Android 11.

就是说,我们不满意仅提供物理设备的基本功能集。 取而代之的是,我们还专注于构建超越标准的工具,以仅在虚拟设备上才能实现的功能来补充物理设备。 新的Android模拟器可折叠和5G功能是Android模拟器如何补充物理设备的两个示例,我们希望它们可以帮助您将应用程序升级为Android 11


翻译自: https://medium.com/androiddevelopers/developing-for-android-11-with-the-android-emulator-a9486af2d7ef

vue折叠面板默认折叠