Java 文本和按钮被覆盖…我希望按钮固定在文本视图的底部
我已经上传了问题的截图,请检查。。。 文本视图中的文本和按钮相互覆盖。我使用html作为文本,滚动条作为文本…请帮助 这是我的密码: xml:Java 文本和按钮被覆盖…我希望按钮固定在文本视图的底部,java,android,html,Java,Android,Html,我已经上传了问题的截图,请检查。。。 文本视图中的文本和按钮相互覆盖。我使用html作为文本,滚动条作为文本…请帮助 这是我的密码: xml: 请注意,文本视图中文本的文本大小可以增加或减少……这是因为您尚未指定视图的对齐顺序 例如:您可以使用上面的android:layout_=“@+id/btn”或下面的android:layout_=“@+id/scrollbar来排列视图。这是因为您尚未指定视图的对齐顺序 例如:您可以使用上面的android:layout_=“@+id/btn”或下面的
请注意,文本视图中文本的文本大小可以增加或减少……这是因为您尚未指定视图的对齐顺序
例如:您可以使用上面的
android:layout_=“@+id/btn”
或下面的android:layout_=“@+id/scrollbar
来排列视图。这是因为您尚未指定视图的对齐顺序
例如:您可以使用上面的
android:layout_=“@+id/btn”
或下面的android:layout_=“@+id/scrollbar
来排列视图。使您的代码如下:
<LinearLayout 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:background="@drawable/images"
android:orientation="vertical"
tools:context="com.example.acer.aartisangrah.alaganraya">
<ScrollView
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1"
android:gravity="center">
<TextView
android:id="@+id/textView4"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center"
android:textAppearance="?android:attr/textAppearanceLarge" />
</ScrollView>
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
<Button
android:id="@+id/b2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:onClick="decrease"
android:text="Decrease" />
<Button
android:id="@+id/b1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_alignParentEnd="true"
android:onClick="increase"
android:text="Increase" />
</RelativeLayout>
使您的代码如下所示:
<LinearLayout 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:background="@drawable/images"
android:orientation="vertical"
tools:context="com.example.acer.aartisangrah.alaganraya">
<ScrollView
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1"
android:gravity="center">
<TextView
android:id="@+id/textView4"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center"
android:textAppearance="?android:attr/textAppearanceLarge" />
</ScrollView>
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
<Button
android:id="@+id/b2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:onClick="decrease"
android:text="Decrease" />
<Button
android:id="@+id/b1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_alignParentEnd="true"
android:onClick="increase"
android:text="Increase" />
</RelativeLayout>
只需将这些添加到布局中即可-
<ScrollView...
android:id=@+id/scroll_view>
...
<Button
android:id="@+id/b2"
android:layout_below=@id/scroll_view
.../>
<Button
android:id="@+id/b1"
android:layout_below=@id/scroll_view
android:layout_toRightof=@id/b1
.../>
...
只需在布局中添加这些-
<ScrollView...
android:id=@+id/scroll_view>
...
<Button
android:id="@+id/b2"
android:layout_below=@id/scroll_view
.../>
<Button
android:id="@+id/b1"
android:layout_below=@id/scroll_view
android:layout_toRightof=@id/b1
.../>
...
只需复制并粘贴我编写的代码,就可以了吗?让scrollview wrape内容与您的代码一样……这是通过增加字体大小……再试一件事。对线性布局进行相对布局。将scrollview高度设为0dp,并将权重设为1。在另一个布局(如linearlayout)中包装两个按钮,然后查看您是否可以在注释代码中进行必要的更改…因为在添加线性布局后,按钮已上升…请仅复制并粘贴我编写的代码,然后查看是否有效?使scrollview包装内容与您的代码仍然相同…这与增加字体大小…再试一件事。对线性布局进行相对布局。将scrollview高度设为0dp,并将权重设为1。将两个按钮包装在另一个布局(如linearlayout)中,然后查看您是否可以在注释代码中进行必要的更改…因为添加线性布局后,按钮已上升…请将这两个按钮放入linearlayout/RelativeLayout(名称id为btnLayout)中。添加android:layout_over=“@+id/btnLayout
到滚动视图将这两个按钮放入线性布局/相对布局(名称id为btnLayout)。将android:layout_over=“@+id/btnLayout
添加到滚动视图中