テキストを非表示にし、テキストビューがアクティビティのスペースを占有し続けるという私の目標は、次を使用してテキストを非表示に設定しました。
tv.setVisibility(View.INVISIBLE);
ボタンをクリックすると、テキストが表示されます。コードの結果がテキストだけでなくテキストビュー全体を非表示にすることを除いて、すべてが正常に機能します。
android:background="@drawable/border1"
<TextView
android:id="@+id/introclusion_tv3"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@drawable/border1"
android:textSize="20sp" />
アプリを起動すると、ボタンをクリックした後にテキストで埋められる空のスペースのみが表示されますが、そこには(形状の背景から来る)境界線がないため、テキストビュー全体を非表示にし、テキストのみを非表示にしてテキストビューを保持する必要がありますテキストが INVISIBLE に設定されている場合に表示される背景、
どんな助けでも本当に感謝します、ありがとう。
これが私がやった方法です:
TextView tv11=(TextView)findViewById(R.id.introclusion_tv3);
tv11.setText(Html.fromHtml(getString(R.string.introclusion_one)));
tv11.setVisibility(View.INVISIBLE);
次に、クリックして正しいパスワードを入力すると、テキストが次のように表示されます。
Button dialogButton = (Button) dialog.findViewById(R.id.dialogButtonOK);
dialogButton.setOnClickListener(new OnClickListener() {
public void onClick(View v) {
dialog.dismiss();
EditText password = (EditText) dialog.findViewById(R.id.password);
if( password.getText().toString().length() > 0 ) {
if( password.getText().toString().equals("test")) {
TextView tv11=(TextView)findViewById(R.id.introclusion_tv3);
tv11.setTypeface(FontFactory.getBFantezy(getBaseContext()));
tv11.setText(Html.fromHtml(getString(R.string.introclusion_one)));
tv11.setVisibility(View.VISIBLE);
}