問題タブ [android-linearlayout]
For questions regarding programming in ECMAScript (JavaScript/JS) and its various dialects/implementations (excluding ActionScript). Note JavaScript is NOT the same as Java! Please include all relevant tags on your question; e.g., [node.js], [jquery], [json], [reactjs], [angular], [ember.js], [vue.js], [typescript], [svelte], etc.
android - How do I get this linearlayout working on android?
I'm trying to create a scrollview that contains a linearlayout with some options inside of it. I'd like for the options to show up at the top and grow downwards, and to have "save," "delete," and "cancel" buttons which show up at the very bottom of the screen (if there is space left in between the bottom of all the options and the top of the buttons).
Here's a screenshot of my attempt:
http: //img375.imageshack.us/img375/3628/10370572.png
(StackOverflow was only letting me post a single link so you'll have to get rid of the space in between http: and the rest)
As you can see, the buttons show up directly below the options rather than at the bottom of the screen. In fact the top level (green) linearlayout doesn't even extend all the way down, despite having a height of fill_parent and a weight of 1 (and the blue is the scrollview, so there is room to expand).
I've tried every possible combination of heights, weights, gravities, and anything else to get this working and still can't do it. Everytime I pasted my xml layout into here, the top and bottom portions got cut off, so instead I pasted it here: pastey link
Can anyone see what I'm doing wrong?
android - Android の新機能: ビューの動的変更
Android 用のアプリを作成する方法を学ぼうとしています。
私が構築したいと考えているより大きなアプリのコンポーネントになる最初の単純なアプリは、タップするとビューに何か新しいものを追加するボタンを画面に表示することです。
例えば:
ボタンしかないレイアウトを想像してみてください:
そのボタンが押されると、ビューに新しい行が追加されます。
その後押すと、さらに行が追加されます
等々。
LinearLayout を作成してボタンを配置し、クリック リスナーをアタッチしました。それはすべてうまくいきます。私が理解できないのは、 onClick 関数で LinearLayout のハンドルを取得する方法です。これを使用して、「何か!」と言う新しい TextView を addView() します。
私は正しい軌道に乗っていますか?私が見逃している基本的なことは何ですか?ありがとう!
android - Android VideoView LinearLayout LayoutParams
私のアプリは、VideoView を使用してビデオを再生します。私は LinearLayout を使用して、いくつかのテキスト、ビデオ、そしていくつかのボタンを追加しています。
私の質問は、VideoView がすべての電話で適切に再生されるようにするために、どのようなレイアウト パラメータを使用できるかということです。基本的に、ポートレート モードの場合は、幅全体を使用し、ビデオの高さを使用する必要があります。横向きのときは、フルスクリーンモードのように見せたいです。
この設定は、縦向きと横向きの両方の myTouch でうまく機能することに気付きました。
new LinearLayout.LayoutParams( LayoutParams.FILL_PARENT,480);
そして、これはDroidで縦向きと横向きの両方で機能します。
new LinearLayout.LayoutParams( LayoutParams.FILL_PARENT, LayoutParams.WRAP_CONTENT);
ありがとうクリス
android - Android -- RelativeLayout と LinearLayout -- VideoView のサイズ変更の問題
ビデオのサイズ変更に問題があります。プログラムでレイアウトを作成する必要があります。コードは次のとおりです。
ルート レイアウトは相対レイアウトです。myText は、ルート レイアウトの上部に追加する Textview です。次に、myText の下に VideoView を追加します。ルート レイアウトの下部に、いくつかのボタンを追加します。
myVideo は、以下のように定義された LinearLayout です。
縦向きモードでは、ビデオが中央に表示され、ビデオが幅全体と適切な高さを占めます。横向きモードでは、ビデオが画面全体を占め (これが私の望みです)、myText はまったく表示されません。
ありがとうクリス
java - Android で TextView を LinearLayout に追加する方法
TextViews
コードで xml 定義のレイアウトに追加しようとしています。多くのViews
ものが定義されているxmlシートがあります。LinearLayout
ただし、コードにいくつかのビューを追加する必要があるため、xml-sheet にa を作成します。
そして、このレイアウトでは、次のように追加したいと思いTextView
ます:
しかし、次のエラーメッセージしか表示されません。
どうすればいいですか?
助けてくれてありがとう。マーティン
java - Android: プログラムで 2 つのテキスト ビューを追加します。
プログラムで線形レイアウトにビューを追加しようとしています。
まず、informationsView を追加しただけで、すべて正常に機能しました。しかし、ラインビューも追加した後、次のエラーでクラッシュしました:
java.lang.IllegalStateException: 指定された子にはすでに親があります。最初に子の親で removeView() を呼び出す必要があります。
そこで、addView(View v, int index) を試してみましたが、同じメッセージでクラッシュしました...
誰かが解決策を持っていますか?
ありがとう、マーティン
android - LinearLayout in ExpandableListView
I want to inflate a childView of ExpandableChildView component.
Code:
Where linearOpt is a vector that contains a lot of LinearLayout objects that I have instantiated.
This is R.layout.itemrow xml:
But I received this error:
07-18 10:48:49.740: ERROR/AndroidRuntime(2738): java.lang.IllegalStateException: The specified child already has a parent. You must call removeView() on the child's parent first.
How I can resolve this issue?
android - 2つのImageButtonをスタックする
2つのImageButtonがあり、一方を他方の上にスタックしようとしています。基本的に、それぞれが使用可能なスペースの50%を占める2つの大きなボタンを備えた画面を作成したいと思います。コードは以下のとおりです。これは、それが生成するレイアウトのキャプチャですhttp://imgur.com/cQT0W.png私が親のlayout_gravityとgravityで遊んだことがあります。layout_height = fill_parentで両方の子を設定しても機能せず、親の重力をfill_verticalに設定することもできません。
android - TextView と VideoView
LinearLayout 内に TextView があり、LinearLayout 内に VideoView があります。
親レイアウトは、TextView の線形レイアウトと VideoView の線形レイアウトを含む RelativeLayout です。
FILL_PARENT、FILL_PARENTパラメーターを使用してVideoViewを追加するため(横向きモードで画面を埋めたいので)、一部の電話では横向きに回転するとVideoViewが画面全体を埋め、TextViewは表示されません。
これは、特定の携帯電話でのみ、横向きモードでのみ発生します。
VideoView の線形レイアウトの上部パディングを設定しようとしましたが、携帯電話ごとにパディングが異なるようです。例: 10 の上部パディングは myTouch では機能しますが、Droid では機能しません。
何か案は?
ありがとうクリス
android - 異なる電話でのパディング
トップ パディングが 20 の線形レイアウトを追加するとします。これは、すべての電話でレイアウトが 20 ピクセルのパディングでレンダリングされるということですか? それとも、電話の高さ/幅/密度に応じてスケーリングしますか?