0
スクロールビューの高さ、幅、余白を設定し、テキストビューの下側と相対レイアウトの右側に設定します。私は、スクロールビューの高さのみを動的に設定しようとしました。しかし、どのようにプログラムそれを維持するには、スクロールビューとどのようにマージンを設定しますAndroidでプログラムでスクロールビューを設定するにはどうすればよいですか?
android:layout_below="@+id/item_textInspectorName"
android:layout_toRightOf="@+id/rel_out_two"
はここに私のXMLコード
<RelativeLayout> ................
<ScrollView
android:id="@+id/scrollExpand"
android:layout_width="fill_parent"
android:layout_height="0dp"
android:layout_below="@+id/item_textInspectorName"
android:layout_toRightOf="@+id/rel_out_two"
android:layout_marginLeft="7.5dp"
android:layout_marginRight="10dp"
android:layout_marginTop="6dp"
android:background="@android:color/white"
android:fillViewport="true">
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="fill_parent">
<com.example.tazeen.classnkk.ExpandableTextView
android:id="@+id/expandable_text"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:ellipsize="end"
android:text="expand"
android:textColor="@android:color/black"
android:textSize="12sp"
android:textStyle="normal" />
</LinearLayout>
</ScrollView>
</RelativeLayout> ................
されており、ここでは、動的の高さを設定されている私の活動のコードです。
ExpandableTextView txtRemark = (ExpandableTextView)findViewById(R.id.expandable_text);
int strRemarkLength = strRemark.length();
if(strRemarkLength > 100)
{
txtRemark.setText(strRemark.concat(" ...Less"));
Log.e("", " Lesss !!!");
scrollView.setLayoutParams(new RelativeLayout.LayoutParams(
RelativeLayout.LayoutParams.FILL_PARENT, 350));
}
else
{
txtRemark.setText(strRemark);
Log.e("", "Not Lesss !!!");
}
に
MainActivity.xml私のサンプル答えるためのおかげです。それは素晴らしいことに役立ちます。 – tazeenmulani