【发布时间】:2018-10-22 04:29:27
【问题描述】:
我正在尝试在片段中添加很长的文本(Glgamesh 的史诗)。
我的xml版本:
<LinearLayout.LayoutParams xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="vertical"
tools:context=".viewOne">
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="@+id/epica"
android:text=" **I WILL INSERT HERE THE WHOLE TEXT?**" />
</LinearLayout.LayoutParams>
还有什么是java部分? 我必须重写 setText 中的内容吗?我可以通过 ID 调用它吗?
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.dynamic_linearlayout);
LinearLayout linearLayout = (LinearLayout) findViewById(R.id.epica);
TextView textView = new TextView(this);
textView.setLayoutParams(new LayoutParams(LayoutParams.WRAP_CONTENT,
LayoutParams.WRAP_CONTENT));
嘿,谢谢!
【问题讨论】:
-
你的问题不清楚你想要达到什么目的。
-
I am trying to问题是 -
我正在尝试[问题的标题:向片段添加很长的文本],问题是[检查帖子的内容]--真的吗?
标签: java android android-studio android-fragments textview