【问题标题】:AVD in Android Studio on Mac is showing buttons as plain textMac 上 Android Studio 中的 AVD 将按钮显示为纯文本
【发布时间】:2015-04-22 20:47:16
【问题描述】:

我刚刚开始在 Mac 上使用 Android Studio。我创建的按钮在 AVD 上显示为文本。谁能帮我解决这个问题?

谢谢。在“设计”窗口中呈现时看起来正确。

<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:paddingBottom="@dimen/activity_vertical_margin"
android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin"
android:paddingTop="@dimen/activity_vertical_margin"
tools:context=".MainActivity" >

<Button
    android:id="@+id/button1"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_alignParentBottom="true"
    android:layout_alignParentRight="true"
    android:layout_marginBottom="188dp"
    android:layout_marginRight="67dp"
    android:onClick="speakText"
    android:text="@string/Speak"
    android:clickable="true"
     />

<EditText
    android:id="@+id/editText1"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_above="@+id/button1"
    android:layout_centerHorizontal="true"
    android:layout_marginBottom="81dp"
    android:ems="10" >
    <requestFocus />
</EditText>

<Button
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:text="New Button"
    android:id="@+id/buttonSpeaker"
    android:layout_alignParentTop="true"
    android:layout_toLeftOf="@+id/button1"
    android:layout_toStartOf="@+id/button1"
    android:clickable="true"/>

【问题讨论】:

  • 你能发一下xml吗

标签: android macos button android-studio avd


【解决方案1】:

类似于材料设计。您可以像这样在style.xml 中继承您的主题

<style name="AppTheme" parent="android:Theme.Holo.Light.DarkActionBar">
    <!-- Customize your theme here. -->
</style>

或者像这样覆盖全局按钮样式 在AppTheme:

<item name="android:buttonStyle">@style/customButtonStyle</item>`

在 style.xml 中

 <style name="customButtonStyle" parent="@android:style/Widget.Button">
        <!-- Customize your button style here. -->
 </style>

【讨论】:

  • 感谢您的回复。我已经有了 style.xml,里面有声明。它不工作。有什么我想念的吗。
  • 请显示布局xml和style.xml。
  • 我仍然不明白为什么 AppTheme 不能像在设计窗口中那样工作。但感谢您指出我正确的方向。我将主题更改为 Theme.dialog,它看起来不一样了。
  • 很高兴有帮助。样式 - 一件有趣的事情)也许 Material 是你的默认主题 avd..
猜你喜欢
  • 2020-10-08
  • 2017-05-08
  • 2021-08-31
  • 2013-05-19
  • 1970-01-01
  • 2021-01-06
  • 2018-04-20
  • 2015-04-30
  • 2012-12-31
相关资源
最近更新 更多