Boo*_*unz 7 screen splash-screen aspect-ratio drawable
我已经为我的应用程序设置了一个加载屏幕(启动),通过一些建议解释了"正确的方法":
styles.xml:
<style name="SplashTheme" parent="Theme.AppCompat.NoActionBar">
<item name="android:windowBackground">@drawable/splash_vector_drawable</item>
</style>
Run Code Online (Sandbox Code Playgroud)
表现:
<activity
android:name="com.tba.versionc.SplashActivity"
android:theme="@style/SplashTheme">
<intent-filter>
<action android:name="android.intent.action.MAIN"/>
<category android:name="android.intent.category.LAUNCHER"/>
</intent-filter>
</activity>
Run Code Online (Sandbox Code Playgroud)
Java的:
public class SplashActivity extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
Intent intent = new Intent(this, MainActivity.class);
startActivity(intent);
finish();
}
}
Run Code Online (Sandbox Code Playgroud)
当我为启动画面设计矢量drawable时,我设置它的宽高比以匹配我的手机(16:9),它似乎工作正常,但我担心在设备上运行时会出现的宽高比会发生什么屏幕比例不同.
为了消除它"伸展以适应"错误尺寸屏幕的可能性,我宁愿它是中心裁剪,但由于它不是ImageView,甚至是布局文件的一部分,我不知道有什么办法设置中心裁剪属性.
任何人?
| 归档时间: |
|
| 查看次数: |
2075 次 |
| 最近记录: |