Osc*_*yes 5 android android-titlebar android-studio
我知道这个问题是在这里之前提出的,但是我已经尝试了给出的解决方案,但我没有像设备那样以确切的样式获得预览外观。
我正在使用Android版本4.2.2上的Samsung Galaxy S3 mini进行设备调试,它是完全未修改的,但是我不明白为什么,即使更改主题,设备仍然看起来相同(在当然是活动)
活动的代码就像任何新的空白活动一样
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent"
android:layout_height="match_parent" android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin"
android:paddingTop="@dimen/activity_vertical_margin"
android:paddingBottom="@dimen/activity_vertical_margin" tools:context=".MainActivity">
<TextView android:text="@string/hello_world" android:layout_width="wrap_content"
android:layout_height="wrap_content" />
</RelativeLayout>
Run Code Online (Sandbox Code Playgroud)
预览看起来像这样

但是设备看起来像这样

PS:我正在学习android,所以我可能会与答案混淆
看起来您在styles.xml文件中定义了一个主题,该主题在模拟器中提供了上述输出。
从 Activity 的设计视图中的AppTheme选项中选择相同的主题(在 styles.xml 中定义),以使其显示您的 ActionBar。

| 归档时间: |
|
| 查看次数: |
6878 次 |
| 最近记录: |