-1
팝업 창에서 텍스트보기에 사용자 정의 글꼴을 사용하려고합니다. 나는 다음 코드를 시도했다.안드로이드 - 팝업 창에서 텍스트보기에 사용자 정의 글꼴을 사용하는 방법
String fontPath1 = "icons.ttf";
TextView txt1 = (TextView)findViewById(R.id.text1);
Typeface tf1 = Typeface.createFromAsset(getAssets(), fontPath1);
txt1.setTypeface(tf1);
그것은 별도의 활동으로 작동한다. 이 코드를 팝업 창에 통합하는 방법.
INSTR 레이아웃 :
여기<RelativeLayout
android:id="@+id/instruction"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:background="@drawable/greenbg"
android:padding="8dp"
android:layout_centerInParent="true" >
<TextView
android:id="@+id/intro"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:text="@string/intro3"
android:textStyle="bold"
android:textColor="#ffffff"
android:textSize="18sp"/>
<LinearLayout
android:id="@+id/int1"
android:layout_below="@id/intro"
android:layout_width="fill_parent"
android:layout_height="40dp"
android:layout_marginTop="2dp"
android:orientation="horizontal"
android:gravity="center|left" >
<TextView
android:id="@+id/textview1"
android:layout_width="wrap_content"
android:layout_height="30dp"
android:text="@string/symbol1"
android:background="@drawable/rulebg2"
android:padding="4dp"
android:layout_marginLeft="3dp"
android:gravity="center|center"
android:textColor="#ffffff"
android:textSize="14sp"/>
<TextView
android:id="@+id/textview2"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="@string/intr1"
android:layout_marginLeft="2dp"
android:padding="2dp"
android:gravity="center|left"
android:textColor="#ffffff"
android:textSize="14sp"/>
</LinearLayout>
</RelativeLayout>
내 팝업 자바 코드 :
이Button inst= (Button) findViewById(R.id.instr);
inst.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
LayoutInflater layoutInflater = (LayoutInflater)getBaseContext()
.getSystemService(LAYOUT_INFLATER_SERVICE);
View popupView = layoutInflater.inflate(R.layout.instr, null);
final PopupWindow popupWindow = new PopupWindow(popupView, LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT, true);
Button btnDismiss = (Button)popupView.findViewById(R.id.closebtn);
btnDismiss.setOnClickListener(new Button.OnClickListener(){
@Override
public void onClick(View v) {
// TODO Auto-generated method stub
popupWindow.dismiss();
}});
popupWindow.showAtLocation(popupView, Gravity.CENTER, 0, 0);
}});
'R.layout.instr'의 내용을 게시 할 수 있습니까? –
사용자 정의 대화 상자 (Google for this)를 사용할 수 있습니다. –