0
私は、マーカーが見えるときにFrameLayoutにTextViewを表示しようとしています。FrameLayoutにTextViewを表示
以下のコードのように:
FrameLayout frameLay = new FrameLayout(context); FrameLayout.LayoutParams layoutParamsFrame = new FrameLayout.LayoutParams(FrameLayout.LayoutParams.FILL_PARENT, FrameLayout.LayoutParams.FILL_PARENT); frameLay.setLayoutParams(layoutParamsFrame); TextView theText = new TextView(context); theText.setText("text_test"); theText.setTextColor(Color.WHITE); theText.setTypeface(Typeface.DEFAULT_BOLD); LayoutParams layoutParamsText = new LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT); theText.setLayoutParams(layoutParamsText); theText.setGravity(Gravity.CENTER_HORIZONTAL | Gravity.BOTTOM); first = true; frameLay.addView(theText);
これは私のために動作しません。マーカーが表示され、このコードを実行しますが、何も起こりません。 これを修正するにはどうすればよいですか?
表示される「マーカー」とは何ですか?また、XMLではなくプログラムでこれをやっている理由はありますか?通常、単純なレイアウトの場合、XMLはすべてを簡単にします。 –
私はいくつかの画像(またはそれ以上)がディスプレイ(マーカ)に表示されているときにのみ表示したい場合があります。また、複数のテキストがあることがあります。 –