所以基本上是 android studio 的新手,我被这个问题困住了,这需要太多时间..
正如标题所说和我提供的图片 - 我想要的结果不匹配.. “x”稍后应该是我的个人信息。我希望模拟器看起来像左图。
感谢任何帮助。
除了主题“DarkactionBar”之外,我的所有东西都可以正常工作。
这是我的代码。
<?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:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".MainActivity">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginStart="8dp"
android:layout_marginLeft="8dp"
android:layout_marginEnd="8dp"
android:layout_marginRight="8dp"
android:gravity="center"
android:orientation="vertical"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="1.0"
app:layout_constraintStart_toEndOf="parent"
tools:ignore="MissingConstraints"
tools:layout_editor_absoluteY="71dp">
<ImageView
android:id="@+id/imageView"
android:layout_width="200dp"
android:layout_height="200dp"
android:adjustViewBounds="true"
tools:srcCompat="@tools:sample/avatars" />
<TextView
android:id="@+id/CvIntro"
style="@style/Mitt_CV_STIL"
android:layout_width="284dp"
android:layout_height="wrap_content"
android:text="@string/CvIntro" />
<Button
android:id="@+id/Button1"
style="@style/Widget.AppCompat.Button.Colored"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="10dp"
android:onClick="TillCV"
android:text="@string/button1"
/>
</LinearLayout>
</android.support.constraint.ConstraintLayout>
最佳答案
问题就在这里
tools:srcCompat="@tools:sample/avatars"
tools 命名空间仅用于设计时目的,请阅读此处 https://developer.android.com/studio/write/tool-attributes
关于java - 线性布局,不按要求出现,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/53634207/