我有像这样的DialogFragment

通过单击MainActivity中最初为空的"加号"按钮来调用对话框.当我点击"继续"时,我创建一个按钮,到目前为止它的工作原理.我也希望我在DialogFragment的EditText中插入的字符串显示在我刚刚创建的按钮上.我的问题是我无法检索我在EditText中输入的字符串.
这是代码:
主要活动
public class MainActivity extends FragmentActivity implements IProjectDialFrag {
private ProjectDialogFragment projectDialFrag = new ProjectDialogFragment();
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
MenuInflater inflater = getMenuInflater();
inflater.inflate(R.menu.main, menu);
return super.onCreateOptionsMenu(menu);
}
@Override
public boolean onOptionsItemSelected(MenuItem item) {
int id = item.getItemId();
switch (id) {
case R.id.action_settings:
//TODO
return true;
case R.id.filters:
Intent intent1 = new Intent(MainActivity.this, FiltersActivity.class);
startActivity(intent1);
return true;
case R.id.action_new:
return true;
case R.id.add_button:
Intent intent2 = …Run Code Online (Sandbox Code Playgroud) 我正在为 android 开发一个应用程序,它需要在操作栏中(靠近溢出)有一个按钮,打开一个下拉菜单作为通过单击溢出按钮出现的菜单。有任何想法吗?谢谢
我有一个CSV包含下表的文件:
users passwords company
Admin test_psw test_cmp
test_user1 test_psw1 test_cmp1
... ... ...
... ... ...
Run Code Online (Sandbox Code Playgroud)
哪里users,passwords和company是表头,表本身可以动态增长。
PDF如何使用将这种表写入文件python?我看了reportlab图书馆,但没有任何想法。
我有CSV一个如下所示的文件:
user,password,company
Administrator, 123456, test_company
test_user1, abcdf, test_company1
test_user2, 789, test_company2
Run Code Online (Sandbox Code Playgroud)
这应该是一个带有user,password和company作为标题的表格。
如何docx使用 python 将该结构作为表写入文件中?
我有一个MainActivity最初是空的。当我单击“加号”按钮时,您会打开一个DialogFragment有两个按钮(“取消”和“继续”)和一个EditText. 在EditText你可以写这个项目(在这种情况下,项目1项)的名称,并单击“继续”,你可以在运行时创建“项目1”,“播放”按钮和TextView“你好”如图所示放置的图像以下。
我希望TextView“你好”位于同一行的“播放”按钮旁边。

这是我的代码:
“继续”按钮的方法:
@Override
public void onDialogPositiveClick(DialogFragment dialog) {
EditText editText = (EditText) dialog.getDialog().findViewById(R.id.project_name);
String projectName = editText.getText().toString();
LinearLayout.LayoutParams lp1 = new LinearLayout.LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT);
lp1.gravity = Gravity.END;
Button projectButton = new Button(this);
projectButton.setText(projectName);
projectButton.setLayoutParams(lp1);
projectButton.setOnClickListener(projectListener);
LinearLayout.LayoutParams lp2 = new LinearLayout.LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT);
lp2.gravity = Gravity.START;
lp2.setMarginStart(10);
Button playButton = new Button(this);
playButton.setBackgroundResource(R.drawable.play_button_green);
playButton.setLayoutParams(lp2);
TextView buttonView = new TextView(this);
buttonView.setText("Hello");
LinearLayout linearLayout = (LinearLayout) findViewById(R.id.button_row);
linearLayout.addView(projectButton);
linearLayout.addView(playButton);
linearLayout.addView(buttonView); …Run Code Online (Sandbox Code Playgroud)