Android:从JSON获取的数据在textview中显示不完整
在我的应用程序中,我从JSON获取文本内容,并将这些内容显示到文本视图中。但,问题是文本看起来不完整,而且格式也不完整。我使用检查了我的JSON,结果显示JSON是有效的。我已经在日志上打印了我收到的内容,它是完整的。甚至,在将其设置为textview并再次从中返回后,我也得到了完整的数据。但是,它并没有显示完整的文本 我不明白问题出在哪里。文本视图位于scrollview内部 下面是我的代码: 基本活动 BaseActivity的布局:Android:从JSON获取的数据在textview中显示不完整,android,json,textview,Android,Json,Textview,在我的应用程序中,我从JSON获取文本内容,并将这些内容显示到文本视图中。但,问题是文本看起来不完整,而且格式也不完整。我使用检查了我的JSON,结果显示JSON是有效的。我已经在日志上打印了我收到的内容,它是完整的。甚至,在将其设置为textview并再次从中返回后,我也得到了完整的数据。但是,它并没有显示完整的文本 我不明白问题出在哪里。文本视图位于scrollview内部 下面是我的代码: 基本活动 BaseActivity的布局: <?xml version="1.0" enco
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:background="@color/white"
android:layout_height="fill_parent"
android:orientation="vertical"
android:id="@+id/baseLayout">
<com.dzo.tie.ui.HeaderBar
android:id="@+id/baseHeaderBar"
android:layout_width="fill_parent"
android:layout_height="50dp"/>
<ScrollView
android:scrollbars="vertical"
android:fillViewport="true"
android:layout_width="fill_parent"
android:layout_height="fill_parent">
<LinearLayout
android:id="@+id/baseScrollContent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:gravity="center"
android:layout_gravity="center"
android:layout_width="fill_parent">
</LinearLayout>
</ScrollView>
我的活动布局
您需要滚动查看文本的其余部分。
把你的文本视图放在一个滚动视图中,它就可以了。问题是,如果你看上面我在上面截屏的前两行,从中间某个地方显示的文本,而原始内容在那个句子的上面有两个段落,我不明白为什么在文本视图中设置了完整的内容后,它会从中间显示内容。请发布相关的源代码。请将其添加到您的问题中。尝试更改布局高度以包装内容,而不是填充内容。请在此处发布您的代码,这样我们可能会帮助您解决问题。。
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:background="@color/white"
android:layout_height="fill_parent"
android:orientation="vertical"
android:id="@+id/baseLayout">
<com.dzo.tie.ui.HeaderBar
android:id="@+id/baseHeaderBar"
android:layout_width="fill_parent"
android:layout_height="50dp"/>
<ScrollView
android:scrollbars="vertical"
android:fillViewport="true"
android:layout_width="fill_parent"
android:layout_height="fill_parent">
<LinearLayout
android:id="@+id/baseScrollContent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:gravity="center"
android:layout_gravity="center"
android:layout_width="fill_parent">
</LinearLayout>
</ScrollView>
public class TIEInfo extends TIEBaseActivity
{
TextView txtTieInfo;
String contents;
private String infoUrl = "http://www.tradeineu.com/tie_app/aboutTie.php";
protected void onCreate(Bundle savedInstanceState)
{
super.createDefaultView(savedInstanceState);
_headerBar.view.setVisibility(View.VISIBLE);
super.setHeaderTitle("Info");
init();
new TIEInfoAsyncTask(getParent(), infoUrl, txtTieInfo).execute();
}//onCreate
public void init()
{
loadFormFromResource(R.layout.tieinfo);
txtTieInfo = (TextView)findViewById(R.id.txtTieInfo);
}//init
}//TIEInfo
<?xml version="1.0" encoding="utf-8"?>
<TextView
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:id="@+id/txtTieInfo"
android:textSize="12sp"
android:textColor="@color/copper_gold"
android:lineSpacingExtra="5dp"/>