android– 片段内容被切断

android– 片段内容被切断,第1张

概述我目前正在开发Android游戏.我在Fragment中的内容有问题.内容被切断,我无法找到问题.我只使用资源目录,在那里我定义了不同的布局.这就是为什么我知道问题在于布局.首先我认为它与我使用android的事实有关:layout_height=“match_parent”.我在StackOverflow上找到了这个解决方案,

我目前正在开发Android游戏.我在Fragment中的内容有问题.内容被切断,我无法找到问题.我只使用资源目录,在那里我定义了不同的布局.这就是为什么我知道问题在于布局.首先我认为它与我使用androID的事实有关:layout_height =“match_parent”.我在StackOverflow上找到了这个解决方案,我希望这也能解决我的问题.但这根本没有帮助我.

我有activity_game.xml.在那里,我有一个占位符,用于显示当前显示的片段.内容如下:

<?xml version="1.0" enCoding="utf-8"?><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="wrap_content"  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="y.Trader.com.rhcloud.blackmonster.games.Tradery.activity.GameActivity">  <FrameLayout    androID:ID="@+ID/fragment_container"    androID:layout_wIDth="match_parent"    androID:layout_height="wrap_content" /></relativeLayout>

Fragment本身定义了以下布局:

<?xml version="1.0" enCoding="utf-8"?><linearLayout xmlns:androID="http://schemas.androID.com/apk/res/androID"  androID:orIEntation="vertical"  androID:layout_wIDth="match_parent"  androID:layout_height="wrap_content"  androID:gravity="center_horizontal">  <TextVIEw    androID:ID="@+ID/money"     />  <TextVIEw    androID:ID="@+ID/location"     />  <ImageVIEw    androID:layout_wIDth="wrap_content"    androID:layout_height="wrap_content"    androID:src="@drawable/junkIE_icon"/>  <ListVIEw    androID:ID="@+ID/drug_List"     />  <tableRow    >    <button        androID:ID="@+ID/sell_drugs"                androID:text="@string/sell"/>    <button        androID:ID="@+ID/nothing"                androID:text="@string/nothing"/>  </tableRow></linearLayout>

这是捕获的屏幕来显示问题.

如您所见,最后两个按钮正在切割.我想避免这种情况,而是让用户向下滚动.我处于一种死亡状态,我将不胜感激.我希望我设法解释这个问题,以便理解.

解决方法:

不使用ScrollVIEw,您可以为ListVIEw设置权重.尝试此解决方案:

 <ListVIEw    ...    androID:layout_weight="1"/>
总结

以上是内存溢出为你收集整理的android – 片段内容被切断全部内容,希望文章能够帮你解决android – 片段内容被切断所遇到的程序开发问题。

如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。

欢迎分享,转载请注明来源:内存溢出

原文地址: http://www.outofmemory.cn/web/1117285.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2022-05-29
下一篇 2022-05-29

发表评论

登录后才能评论

评论列表(0条)

保存