我从android studio开始,但我看不到元素(按钮、TextView、..)我在activity_main.xml
页面中拖放我的设计页面。这些元素存在于我的XML文件中,当我在我的设备上运行我的应用程序时,我可以看到它们,但我不知道如何在“设计和蓝图”页面上看到它们。
谢谢你的帮助。
这是我的xml代码:
<?xml version="1.0" encoding="utf-8"?>
<android.support.constraint.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/container"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".MainActivity"
tools:layout_editor_absoluteY="25dp">
<TextView
android:id="@+id/message"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/title_home"
app:layout_constraintBottom_toTopOf="parent"
app:layout_constraintEnd_toStartOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<android.support.design.widget.BottomNavigationView
android:id="@+id/navigation"
android:layout_width="1dp"
android:layout_height="wrap_content"
android:background="?android:attr/windowBackground"
app:layout_constraintBottom_toTopOf="parent"
app:layout_constraintEnd_toStartOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:menu="@menu/navigation" />
<Button
android:id="@+id/button"
android:layout_width="12dp"
android:layout_height="12dp"
android:text="ClickMe"
tools:layout_editor_absoluteX="-73dp"
tools:layout_editor_absoluteY="29dp" />
<android.support.constraint.Guideline
android:id="@+id/guideline"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="vertical"
app:layout_constraintGuide_begin="20dp" />
</android.support.constraint.ConstraintLayout>
我的画布完全是空的。
编辑:
我有两个错误:
Failed to find style 'bottomNavigationStyle' in current theme Tip: Try to refresh the layout.
This view is not constrained. It only has designtime positions, so it will jump to (0,0) at runtime unless you add the constraints
中的
发布于 2018-08-26 08:05:39
您可以通过修复styles.xml文件来解决此问题。
然后,您只需在此代码中添加Base:
<style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar">
最后的代码:
<style name="AppTheme" parent="Base.Theme.AppCompat.Light.DarkActionBar">
发布于 2018-06-17 22:43:13
如果出现与此页相同的错误,则应在build.gradle(Module: app)
中将com.android.support:appcompat-v7:28.0.0-alpha3
更改为com.android.support:appcompat-v7:28.0.0-alpha1
,然后单击文件->无效缓存/重新启动。现在一切都好了。
当然,你需要通过互联网下载com.android.support:appcompat-v7:28.0.0-alpha1
发布于 2018-07-19 07:44:12
要解决此问题,请执行以下操作:
https://stackoverflow.com/questions/50897282
复制相似问题