0

textview 内のテキストを正当化したい.textview 内のコンテンツを正当化する方法はあります.webview を使用したくない.ライブラリはありますか??Plz は私を助けてくれます. ..

Justify.xml

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
     android:background="@drawable/back1"
    android:orientation="vertical" >

    <ImageView
        android:id="@+id/imageView1"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:src="@drawable/banner" />

    <TextView
        android:id="@+id/textView1"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_marginLeft="120dp"
        android:layout_marginTop="20dp"
        android:text="About Us" />

    <ScrollView
        android:id="@+id/scrollView1"
        android:layout_width="fill_parent"
        android:layout_height="fill_parent"
        android:layout_alignParentTop="true" >

            <TextView
                android:id="@+id/textView"
                android:layout_width="fill_parent"
                android:layout_height="fill_parent"

                android:layout_weight="0.94"
                android:text="Paragraph\n\nParagraph"

    </ScrollView>

アクティビティ

public class About_us extends Activity {
TextView txtName;
TextView txtName1;
    @SuppressLint("NewApi")
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_about_us);
        getActionBar().setDisplayHomeAsUpEnabled(true);
        txtName = (TextView) findViewById(R.id.textView);
        txtName.setTextColor(Color.WHITE);
        txtName1 = (TextView) findViewById(R.id.textView1);
        txtName1.setTextColor(Color.WHITE);
        txtName1.setTextSize(16);
    }

    @Override
    public boolean onCreateOptionsMenu(Menu menu) {
        // Inflate the menu; this adds items to the action bar if it is present.
        getMenuInflater().inflate(R.menu.about_us, menu);
        return true;
    }
4

1 に答える 1

2

Android は、デフォルトで TextView の完全な両端揃えをサポートしていません。そのためには WebView を使用する必要がありますが、Webview を使用したくないためです。したがって、解決策はANDROID Text-Justify 2.0 Library です。

そのライブラリは、次の github リンクで見つけることができます

https://github.com/bluejamesbond/TextJustify-Android

完全なセットアップ情報は、同じリンクで提供されます。

于 2014-11-26T13:32:21.467 に答える