本文整理汇总了Java中android.support.v7.app.AppCompatActivity.getLayoutInflater方法的典型用法代码示例。如果您正苦于以下问题:Java AppCompatActivity.getLayoutInflater方法的具体用法?Java AppCompatActivity.getLayoutInflater怎么用?Java AppCompatActivity.getLayoutInflater使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类android.support.v7.app.AppCompatActivity
的用法示例。
在下文中一共展示了AppCompatActivity.getLayoutInflater方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: showWhiteSnackBar
import android.support.v7.app.AppCompatActivity; //导入方法依赖的package包/类
public static void showWhiteSnackBar(int signed_in_message, AppCompatActivity compatActivity) {
LayoutInflater inflater = compatActivity.getLayoutInflater();
View layout = inflater.inflate(R.layout.custom_toast_view,
(ViewGroup) compatActivity.findViewById(R.id.custom_toast_container));
TextView text = (TextView) layout.findViewById(R.id.text);
text.setText(signed_in_message);
Toast toast = new Toast(compatActivity);
toast.setDuration(Toast.LENGTH_SHORT);
toast.setView(layout);
toast.show();
}
示例2: promptRollNo
import android.support.v7.app.AppCompatActivity; //导入方法依赖的package包/类
public static AlertDialog promptRollNo(final AppCompatActivity context){
final SharedPref sharedPref=new SharedPref(context);
AlertDialog.Builder alertDialogBuilder=new AlertDialog.Builder(context);
LayoutInflater inflater=context.getLayoutInflater();
LinearLayout l= (LinearLayout) inflater.inflate(R.layout.dialog_register_rollno,null);
alertDialogBuilder.setView(l);
final CheckBox checkBox= (CheckBox) l.findViewById(R.id.checkbox_register);
final EditText rollNoEditText= (EditText) l.findViewById(R.id.rollno_register);
final EditText phoneNoEditText= (EditText) l.findViewById(R.id.phone_register);
checkBox.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
@Override
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
if(isChecked){
rollNoEditText.setVisibility(View.VISIBLE);
phoneNoEditText.setVisibility(View.VISIBLE);
}
else {
rollNoEditText.setVisibility(View.GONE);
phoneNoEditText.setVisibility(View.GONE);
}
}
});
alertDialogBuilder.setPositiveButton("Submit", new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
Intent i=new Intent(context, UploadService.class);
i.putExtra(REGISTER_ROLL_NO,true);
i.putExtra(ROLL_NO,rollNoEditText.getText().toString());
if(checkBox.isChecked()){
sharedPref.setNitianStatus(true);
sharedPref.setUserRollno(rollNoEditText.getText().toString());
context.startService(i);
}
else{
sharedPref.setNitianStatus(false);
sharedPref.setUserRollno("");
}
}
});
return alertDialogBuilder.create();
}
示例3: promptRollNo
import android.support.v7.app.AppCompatActivity; //导入方法依赖的package包/类
public static AlertDialog promptRollNo(final AppCompatActivity context){
final SharedPref sharedPref=new SharedPref(context);
AlertDialog.Builder alertDialogBuilder=new AlertDialog.Builder(context);
LayoutInflater inflater=context.getLayoutInflater();
LinearLayout l= (LinearLayout) inflater.inflate(R.layout.dialog_register_rollno,null);
alertDialogBuilder.setView(l);
final CheckBox checkBox= (CheckBox) l.findViewById(R.id.checkbox_register);
final EditText rollNoEditText= (EditText) l.findViewById(R.id.rollno_register);
final EditText phoneNoEditText= (EditText) l.findViewById(R.id.phone_register);
checkBox.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
@Override
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
if(isChecked){
rollNoEditText.setVisibility(View.VISIBLE);
phoneNoEditText.setVisibility(View.VISIBLE);
}
else {
rollNoEditText.setVisibility(View.GONE);
phoneNoEditText.setVisibility(View.GONE);
}
}
});
alertDialogBuilder.setPositiveButton("Submit", new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
Intent i=new Intent(context, UploadService.class);
i.putExtra(REGISTER_ROLL_NO,true);
i.putExtra(ROLL_NO,rollNoEditText.getText().toString());
if(checkBox.isChecked()){
sharedPref.setNitianStatus(true);
sharedPref.setUserRollno(rollNoEditText.getText().toString());
context.startService(i);
}
else{
sharedPref.setNitianStatus(false);
sharedPref.setUserRollno("");
}
}
});
return alertDialogBuilder.create();
}