Android 如何使用标签视图更改settext大小
我在我的应用程序上工作,从自定义设置文本、texcolor和字体 现在,我的问题是 当我调用文本到activity@stickerAndroid 如何使用标签视图更改settext大小,android,dialog,Android,Dialog,我在我的应用程序上工作,从自定义设置文本、texcolor和字体 现在,我的问题是 当我调用文本到activity@stickertextview但无法缩放时 或者出去 下面是我的代码: textsys.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { // custom dialog
textview
但无法缩放时
或者出去
下面是我的代码:
textsys.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
// custom dialog
final Dialog dialog = new Dialog(context);
dialog.setContentView(R.layout.popup_text);
// set the custom dialog components - text, image and button
final EditText poupedittext = (EditText) dialog.findViewById(R.id.poupedittext);
final TextView popupcolor = (TextView) dialog.findViewById(R.id.popupcolor);
final Spinner spin = (Spinner) dialog.findViewById(R.id.spin);
TextView popupdelete = (TextView) dialog.findViewById(R.id.popupdelete);
TextView popupdone = (TextView) dialog.findViewById(R.id.popupdone);
//final_result = poupedittext.getText().toString();
popupcolor.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
ColorPickerDialogBuilder
.with(Frame_Selected.this)
.setTitle("Choose color")
.initialColor(currentBackgroundColor)
.wheelType(ColorPickerView.WHEEL_TYPE.FLOWER)
.density(12)
.setOnColorSelectedListener(new OnColorSelectedListener() {
@Override
public void onColorSelected(int selectedColor) {
selectcolor = selectedColor;
Toast.makeText(getApplicationContext(), "onColorSelected: 0x" + selectedColor, Toast.LENGTH_SHORT).show();
}
})
.setPositiveButton("ok", new ColorPickerClickListener() {
@Override
public void onClick(DialogInterface dialog, int selectedColor, Integer[] allColors) {
changeBackgroundColor(selectedColor);
}
private void changeBackgroundColor(int selectedColor) {
currentBackgroundColor = selectedColor;
poupedittext.setTextColor(selectedColor);
}
})
.setNegativeButton("cancel", new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
}
})
.build()
.show();
popupcolor.setTextColor(popupcolor.getTextColors());
}
});
// Spinner element
// Spinner Drop down elements
List<String> categories = new ArrayList<String>();
categories.add("Above");
categories.add("Airways");
categories.add("Alger");
categories.add("Digifaw");
categories.add("Itckrist");
categories.add("Jokerman");
categories.add("Ojason");
categories.add("Oldengl");// Creating adapter for spinner
categories.add("Rosewood");// Creating adapter for spinner
ArrayAdapter<String> dataAdapter = new ArrayAdapter<String>(Frame_Selected.this, android.R.layout.simple_spinner_item, categories);
// Drop down layout style - list view with radio button
dataAdapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
// attaching data adapter to spinner
spin.setAdapter(dataAdapter);
spin.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() {
@Override
public void onItemSelected(AdapterView<?> parent, View view, int position, long id) {
font = Selected_font;
switch (position) {
case 0:
String a = "fonts/Above.ttf";
Typeface face = Typeface.createFromAsset(getAssets(), a);
poupedittext.setTypeface(face);
Selected_font = a;
break;
case 1:
String b = "fonts/Airways.ttf";
Typeface face1 = Typeface.createFromAsset(getAssets(), b);
poupedittext.setTypeface(face1);
Selected_font = b;
break;
case 2:
String c = "fonts/ALGER.ttf";
Typeface face2 = Typeface.createFromAsset(getAssets(), c);
poupedittext.setTypeface(face2);
Selected_font = c;
break;
case 3:
String d = "fonts/digifaw.ttf";
Typeface face3 = Typeface.createFromAsset(getAssets(), d);
poupedittext.setTypeface(face3);
Selected_font = d;
break;
case 4:
String e = "fonts/ITCKRIST.TTF";
Typeface face4 = Typeface.createFromAsset(getAssets(), e);
poupedittext.setTypeface(face4);
Selected_font = e;
break;
case 5:
String f = "fonts/JOKERMAN.TTF";
Typeface face5 = Typeface.createFromAsset(getAssets(), f);
poupedittext.setTypeface(face5);
Selected_font = f;
break;
case 6:
String g = "fonts/JUICE_Regular.ttf";
Typeface face6 = Typeface.createFromAsset(getAssets(), g);
poupedittext.setTypeface(face6);
Selected_font = g;
break;
case 7:
String h = "fonts/oj.TTF";
Typeface face7 = Typeface.createFromAsset(getAssets(), h);
poupedittext.setTypeface(face7);
Selected_font = h;
break;
case 8:
String j = "fonts/OLDENGL.TTF";
Typeface face8 = Typeface.createFromAsset(getAssets(), j);
poupedittext.setTypeface(face8);
Selected_font = j;
break;
case 9:
String k = "fonts/Rosewood.TTF";
Typeface face9 = Typeface.createFromAsset(getAssets(), k);
poupedittext.setTypeface(face9);
Selected_font = k;
break;
default:
String def = "fonts/Above.ttf";
Typeface faced = Typeface.createFromAsset(getAssets(), def);
poupedittext.setTypeface(faced);
Selected_font = def;
break;
}
spin.setSelection(position);
}
@Override
public void onNothingSelected(AdapterView<?> parent) {
}
});
popupdone.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
StickerTextView tv_sticker = new StickerTextView(Frame_Selected.this);
stickertext=poupedittext.getText().toString();
//set text
tv_sticker.setText(stickertext);
//set color
tv_sticker.setColor(selectcolor);
//set typeface
tv_sticker.setTypeFace(Typeface.createFromAsset(getAssets(),Selected_font));
canvas.addView(tv_sticker);
dialog.dismiss();
}
});
popupdelete.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
dialog.dismiss();
}
});
dialog.show();
textsys.setOnClickListener(新视图.OnClickListener(){
@凌驾
公共void onClick(视图){
//自定义对话框
最终对话框=新对话框(上下文);
setContentView(R.layout.popup_text);
//设置自定义对话框组件-文本、图像和按钮
final EditText poupedittext=(EditText)dialog.findViewById(R.id.poupedittext);
final TextView popupcolor=(TextView)dialog.findViewById(R.id.popupcolor);
最终微调器旋转=(微调器)dialog.findViewById(R.id.spin);
TextView popupdelete=(TextView)dialog.findViewById(R.id.popupdelete);
TextView popupdone=(TextView)dialog.findViewById(R.id.popupdone);
//最终结果=poupidettext.getText().toString();
setOnClickListener(新视图.OnClickListener(){
@凌驾
公共void onClick(视图v){
ColorPickerDialogBuilder
.带有(已选择帧\此)
.setTitle(“选择颜色”)
.initialColor(currentBackgroundColor)
.wheelType(ColorPickerView.WHEEL\u TYPE.FLOWER)
.密度(12)
.setOnColorSelectedListener(新OnColorSelectedListener(){
@凌驾
已选择颜色的公共空白(int-selectedColor){
selectcolor=selectedColor;
Toast.makeText(getApplicationContext(),“onColorSelected:0x”+selectedColor,Toast.LENGTH_SHORT).show();
}
})
.setPositiveButton(“确定”,新的ColorPickerClickListener(){
@凌驾
public void onClick(DialogInterface对话框,int-selectedColor,Integer[]allColors){
更改背景颜色(selectedColor);
}
私有void changeBackgroundColor(int-selectedColor){
currentBackgroundColor=selectedColor;
poupedittext.setTextColor(selectedColor);
}
})
.setNegativeButton(“取消”,新建DialogInterface.OnClickListener()){
@凌驾
public void onClick(DialogInterface dialog,int which){
}
})
.build()
.show();
setTextColor(popupcolor.getTextColors());
}
});
//旋转元件
//微调器下拉元素
列表类别=新建ArrayList();
类别。添加(“上述”);
类别。添加(“航空公司”);
类别。添加(“代数”);
类别。添加(“Digifaw”);
类别。添加(“Itckrist”);
类别。添加(“Jokerman”);
类别。添加(“Ojason”);
categories.add(“Oldengl”);//为微调器创建适配器
categories.add(“Rosewood”);//为微调器创建适配器
ArrayAdapter dataAdapter=新的ArrayAdapter(Frame_Selected.this,android.R.layout.simple_spinner_项目,类别);
//下拉式布局样式-带单选按钮的列表视图
dataAdapter.setDropDownViewResource(android.R.layout.simple\u微调器\u下拉项);
//将数据适配器连接到微调器
spin.setAdapter(dataAdapter);
spin.setOnItemSelectedListener(新的AdapterView.OnItemSelectedListener(){
@凌驾
已选择公共视图(AdapterView父视图、视图视图、整型位置、长id){
字体=所选字体;
开关(位置){
案例0:
字符串a=“font/over.ttf”;
Typeface=Typeface.createFromAsset(getAssets(),a);
poupedittext.setTypeface(面);
所选字体=a;
打破
案例1:
字符串b=“font/Airways.ttf”;
Typeface face1=Typeface.createFromAsset(getAssets(),b);
poupedittext.setTypeface(面1);
所选字体=b;
打破
案例2:
字符串c=“font/ALGER.ttf”;
Typeface face2=Typeface.createFromAsset(getAssets(),c);
poupedittext.setTypeface(面2);
所选字体=c;
打破
案例3:
String d=“font/digifaw.ttf”;
Typeface face3=Typeface.createFromAsset(getAssets(),d);
poupedittext.setTypeface(面3);
所选字体=d;
打破
案例4:
字符串e=“font/ITCKRIST.TTF”;
Typeface face4=Typeface.createFromAsset(getAssets(),e);
poupedittext.setTypeface(第4面);