尝试证明文本是正确的但是我无法做到这一点我想从左侧和右侧开始以相同的边距开始文本。怎么做?
Dictionary<object, object> dictionary2 = array1
.Select((obj, index) => new KeyValuePair<object, object>(array1[index], speed[index]))
.ToDictionary(kvp => kvp.Key, kvp => kvp.Value);
Dictionary<object, object> dictionary3 = array1
.Select((obj, index) => index)
.ToDictionary(i => array1[i], i => speed[i]);
Dictionary<object, object> dictionary4 = Enumerable.Range(0,5)
.ToDictionary(i => array1[i], i => speed[i]);
答案 0 :(得分:2)
答案 1 :(得分:0)
首先,Android不支持完整的理由,但如果你想证明你的文字是合理的,那就试试吧
只需添加到build.gradle
即可dependencies {
compile 'com.github.bluejamesbond:textjustify-android:2.1.6'
}
https://github.com/bluejamesbond/TextJustify-Android
或强>
试试这种方式
public class MainActivity extends Activity {
private JustifiedTextView mJTv;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
mJTv=(JustifiedTextView) findViewById(R.id.activity_main_jtv_text);
mJTv.setText(getResources().getString(R.string.test));
mJTv.setTextSize(TypedValue.COMPLEX_UNIT_SP,20);
mJTv.setLineSpacing(15);
mJTv.setBackgroundColor(Color.RED);
mJTv.setAlignment(Align.LEFT);
mJTv.setTypeFace(Typeface.createFromAsset(getAssets(), "fonts/naskh_bold.ttf"));
}
}
XML
<ir.noghteh.JustifiedTextView
android:id="@+id/activity_main_jtv_text"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="right"
android:padding="25dp"
xmlns:noghteh="http://noghteh.ir"
noghteh:text="@string/hello_world"
noghteh:textColor="@color/text"
noghteh:textSize="18sp"
>
</ir.noghteh.JustifiedTextView>
答案 2 :(得分:0)
在textview android中对齐文本。
String dis="You can write your content here"; String text_string="<html><body style=\"text-align:justify\">"+dis+"<body><html>"; TextView text=setText(fromHtml(text_string));