グリッドレイアウトに関していくつかの問題があります。 私は、画面全体をカバーし、行と列の数が固定されているグリッドレイアウトを持っているとします(例:8/8)。さあ、私は挿入された列と行にのみ一致する2つのカスタムビューを挿入したいとしましょう。正確な列と行にビューを配置し、その列を塗りつぶす方法GridLayout android
絵が悪い場合、私は申し訳ありません:列の幅と高さは、デバイスの画面に固定され、ビューがそれを広めるべきではないと考えているD、代わりに彼らはそれを埋める必要があります1列。私はこれを達成することは可能だと確信していますが、残念ながら私は今まで解決策を見つけていません。どんな助けでも大変感謝しています。
<GridLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#0099cc"
tools:context="com.example.luka.gridlayouttest.FullscreenActivity"
android:columnCount="12"
android:rowCount="12"
android:columnOrderPreserved="true"
android:rowOrderPreserved="true">
<TextView
android:text="TextView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/textView5"
android:layout_row="1"
android:layout_column="3"/>
<TextView
android:text="TextView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/textView6"
android:layout_row="4"
android:layout_column="6" />
</GridLayout>
親と行数および列数が12のグリッドレイアウトを作成しました。 textViewを画面上で動かそうとしましたが、体重、スパンの幅と高さで遊んでいました。私は左上隅から移動することはできませんが、私は重量やスパンを変更する場合を除いて、列と行が変更され、テキストビューは空の行と列を食べるだけです...私はそれが愚かな質問ですが、グリッドレイアウトを使用する必要はありません... – vibetribe93
試したコードを投稿できますか? – Isaac
私は元の質問にコードを挿入しましたが、これは単に選択した列と行に要素を配置することです。単純ですが...しかし複雑なhehehe:P – vibetribe93