Android Studio中版的位置:2.2.3Android Studio中:XML文件(设计选项卡)不能调整大小或TextView的
目标:在XML
文件通过设计选项卡调整的TextView组件的大小。
我在做什么:在XML文件的设计选项卡中,在侧边栏中拖动Widgets文件夹中的“TextView”组件。然后,我抓住8个小盒子中的一个,并试图拉伸它(就像世界上大多数节目一样)。
预期输出:我希望“TextView”组件成为伸展组件时所勾画的新大小。
发生了什么:TextView的原点正好在父对象(content_main)的原点上,并且不会更改大小。
我可以在XML文件的文本选项卡中手动更改大小。话虽如此,我认为有一些错误的android:layout_width和高度= wrap_content。如果我将其更改为任何我想要的px,我会得到预期的输出。我该怎么做才能在设计选项卡中修改尺寸?
[编辑]适用于一切,我投入和container.xml设计选项卡(按钮,文本输入...)
的content.xml:
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout 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/content_main"
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"
android:background="#006699"
app:layout_behavior="@string/appbar_scrolling_view_behavior"
tools:context="com.brandonwillis.myapplication.MainActivity"
tools:showIn="@layout/activity_main">
<TextView
android:text="TextView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/textView"
android:layout_alignParentTop="true"
android:layout_alignParentStart="true" />
</RelativeLayout>
activity_main.xml中:
<?xml version="1.0" encoding="utf-8"?>
<android.support.design.widget.CoordinatorLayout 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"
android:fitsSystemWindows="true"
tools:context="com.brandonwillis.myapplication.MainActivity">
<android.support.design.widget.AppBarLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:theme="@style/AppTheme.AppBarOverlay">
<android.support.v7.widget.Toolbar
android:id="@+id/toolbar"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
android:background="?attr/colorPrimary"
app:popupTheme="@style/AppTheme.PopupOverlay"
android:minHeight="151dp" />
</android.support.design.widget.AppBarLayout>
<android.support.design.widget.FloatingActionButton
android:id="@+id/fab"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="bottom|end"
android:layout_margin="@dimen/fab_margin"
app:srcCompat="@android:drawable/ic_dialog_email" />
<include layout="@layout/content_main"
android:visibility="visible" />
</android.support.design.widget.CoordinatorLayout>
视频我在做什么: https://www.youtube.com/watch?v=6NEtkrlnV6o
方面的问题(我可能找到其他地方),我怎样才能正确地格式化我的代码在StackOverflow?它显然失去了它的缩进。我打开代码括号并粘贴在我的代码中。
这听起来像你拉约束,而不是规模的按钮。约束按钮位于视图的平面上,为了缩放,您只需要抓住“TextView”的角点。 –
Android开发(第1天)非常新颖,那么这些约束和缩放按钮是什么?另外,我不知道你的意思是“平面的观点”。另外,如果我抓住角落,它会捕捉到原点,所以其他的东西一定是错的。我将在此期间研究这些事情的含义。谢谢 –
为什么这个问题被低估?我尽可能以最精细的方式提出了问题,并发布了一段视频。我想我已经完成了这个网站。 –