나는 각 항목에 아랍어 텍스트와 함께 안드로이드에서 간단한 Listview를 만들려고합니다. 문제는 표시되는 텍스트가 완전히 손상되어 아랍어가 아니라는 것입니다. Android Studio 인코딩을 UTF-8로 설정했지만 도움이되지 않습니다. 다음은 안드로이드에 아랍어 텍스트 ListView
는public class CategoryActivity extends AppCompatActivity {
// Array of strings...
String[] mobileArray = {"الرياضي","عربي وعالمي","الثقافي","دنيا","الامارات"};
//String[] mobileArray ={"zaid", "ahmad", "abdallah"};
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_category);
ArrayAdapter adapter = new ArrayAdapter<String>(this,
R.layout.activity_listview, mobileArray);
ListView listView = (ListView) findViewById(R.id.mobile_list);
listView.setAdapter(adapter);
}
}
다음
내 xml 파일은,
activity_category.xml
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<ListView
android:id="@+id/mobile_list"
android:layout_width="match_parent"
android:layout_height="wrap_content" >
</ListView>
</LinearLayout>
activity_listvie 내 안드로이드 코드 w.xml
<TextView xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/label"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:padding="10dip"
android:textSize="16dip"
android:textStyle="bold"
android:gravity="right">
</TextView>
참고 :는 XML 파일 작품의 문자열 배열을 하드 코딩,하지만 난 그것을 원하지 않는다. 나는 런타임에 데이터베이스에서 배열을 가져오고 싶다.
http://stackoverflow.com/questions/7962704/how-to-support-arabic-text-in-android?rq=1 –
아랍어 텍스트를 파일에서 읽으려고 했습니까? –
아니, 나는 그것을 시도하지 않았다. –