Я пытаюсь разместить 4 изображения и одно текстовое изображение над gridview, и мой макет должен мне понравиться (синий текст, оранжевое изображение и следующий сетка) и промежуточный промежуток также необходим. Я искал, но не смог достичь своего мнения. Я указал here на мой макет сетки. Помогите мне в этом. Заранее спасибо.Изображение и текст над макетом gridview
0
A
ответ
0
// try this
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:padding="10dp">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="10dp"
android:gravity="right">
<ImageView
android:layout_width="100dp"
android:layout_height="50dp"
android:src="@drawable/ic_launcher"
android:adjustViewBounds="true"
android:scaleType="fitXY"/>
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center_vertical"
android:layout_marginTop="10dp">
<ImageView
android:layout_width="30dp"
android:layout_height="30dp"
android:src="@drawable/ic_launcher"
android:adjustViewBounds="true"
android:scaleType="fitXY"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="10dp"
android:text="textview"/>
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center_vertical"
android:layout_marginTop="10dp">
<ImageView
android:layout_width="30dp"
android:layout_height="30dp"
android:src="@drawable/ic_launcher"
android:adjustViewBounds="true"
android:scaleType="fitXY"/>
<ImageView
android:layout_width="30dp"
android:layout_height="30dp"
android:src="@drawable/ic_launcher"
android:adjustViewBounds="true"
android:scaleType="fitXY"/>
</LinearLayout>
<GridView
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_marginTop="20dp"
android:layout_weight="1">
</GridView>
</LinearLayout>
+0
Его рабочий друг. Спасибо u :-) – AndroidOptimist
+0
@ AndroidOptimist, привет, вы можете PLZ увеличить ставку, если она вам полезна благодаря ... –
0
Try ниже код:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:background="#ffffff"
android:orientation="vertical" >
<RelativeLayout
android:id="@+id/layoutHead"
android:layout_width="fill_parent"
android:layout_height="match_parent" >
<RelativeLayout
android:layout_width="wrap_content"
android:layout_height="match_parent" >
<ImageView
android:id="@+id/imgOrange"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_margin="5dip"
android:background="@drawable/ic_launcher" />
</RelativeLayout>
<LinearLayout
android:id="@+id/linearmain"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical" >
<LinearLayout
android:id="@+id/linear"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@+id/imgOrange"
android:orientation="horizontal" >
<ImageView
android:id="@+id/imgOrange1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_margin="5dip"
android:background="@drawable/ic_launcher" />
<TextView
android:id="@+id/txtTemp"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:gravity="center_vertical"
android:text="test" />
</LinearLayout>
<LinearLayout
android:id="@+id/linear1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@+id/imgOrange"
android:orientation="horizontal" >
<ImageView
android:id="@+id/imgOrange2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_margin="5dip"
android:background="@drawable/ic_launcher" />
<TextView
android:id="@+id/txtTemp1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:gravity="center_vertical"
android:text="test" />
</LinearLayout>
<GridView
android:id="@+id/gridview"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_marginTop="20dp"
android:columnWidth="90dp"
android:gravity="center"
android:horizontalSpacing="10dp"
android:numColumns="auto_fit"
android:smoothScrollbar="true"
android:stretchMode="columnWidth"
android:verticalSpacing="10dp" />
</LinearLayout>
</RelativeLayout>
</LinearLayout>
Смежные вопросы
- 1. вид скользящий над макетом
- 2. Android layoutdisplay, макет над макетом.
- 3. Установить макет над другим макетом
- 4. Держите плавающее действие над макетом
- 5. Как реализовать слой над макетом?
- 6. Как добавить изображение и текст в графический документ для gridview?
- 7. Создать диалог по щелчку над макетом
- 8. Как отображать ImageView над и под GridView?
- 9. Как нарисовать динамический чертеж над макетом
- 10. Прокручиваемый и щелкнимый текст в gridview android
- 11. Картина над GridView
- 12. Как отображать изображение и текст в той же ячейке GridView?
- 13. Метод getView, отображающий текст и изображение в GridView?
- 14. Как показать текст над DataGridViewImageColumn
- 15. aspdotnetstorefront - (! SITE_NAME!) Не работает над всплывающим макетом
- 16. Обнаружение жеста не работает над макетом
- 17. Android setVisibility (View.Visible) не работает над макетом
- 18. ImageView над ImageView в GridView
- 19. панель навигации расположения над макетом деятельности
- 20. Как добавить представление над макетом ящика?
- 21. Как вертикально выровнять текст и изображение над JRadioButton?
- 22. Мышь над: текст на изображение и ссылка - HTML-решение
- 23. Разница между макетом и макетом-400dp-land
- 24. разницы между макетом и фрагментом макетом
- 25. Различия между макетом эмулятора и макетом телефона
- 26. Меню и текст над изображением баннера, отзывчивый
- 27. Текст ссылки центра над изображением
- 28. GridView RowCommand события и сохранение текст
- 29. Центрированное изображение и текст влево, нажав изображение
- 30. ModalPopupExtender, GridView и IE6 - Исчезающее изображение заголовка
Просто используйте RelativeLayout, чтобы обернуть компоненты нужно, и указать свою позицию отдельно. – reTs
может у вас объяснить это простым примером – AndroidOptimist
@ Alliswell прочитал это http://www.mkyong.com/android/android-relativelayout-example/ – Metalhead1247