我在相对布局中使用GridView.我希望GridView显示为显示所有行所需的高度.但是,我在设置时只看到一行(layout_width = MATCH_PARENT和) layout_height = WRAP_CONTENT.如果我将layout_height设置为等于多行的大小,那么我确实看到了这些行.
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:gravity="center"
>
<RelativeLayout
android:id="@+id/layout_month"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
>
<TextView
android:id="@+id/textv_month_name"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:clickable="false"
android:gravity="center_horizontal|center_horizontal"
android:textColor="#ffffff"
android:textSize="7dp" />
<ImageView
android:id="@+id/top_bar"
android:layout_width="fill_parent"
android:layout_height="15dp"
android:layout_below="@+id/textv_month_name"
android:background="@drawable/calendar_top_small"
android:clickable="false" />
<GridView
android:id="@+id/gridv_inner"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_below="@+id/top_bar"
android:layout_gravity="center"
android:clickable="false"
android:gravity="center"
android:numColumns="7"
android:stretchMode="columnWidth"
>
</GridView>
<Button
android:id="@+id/monthBtn"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:background="@android:color/transparent" />
</RelativeLayout>
</RelativeLayout>
Run Code Online (Sandbox Code Playgroud)
任何帮助都会很明显
我正在尝试将roboelectric整合到我的新项目中.我使用以下链接来理解和实施roboelectric
http://pivotallabs.com/setting-up-robolectric-in-android-studio-1-1-on-os-x/
http://nenick-android.blogspot.in/2015/02/android-studio-110-beta-4-and.html
http://raptordigital.blogspot.in/2014/02/test-driven-development-with.html
但是我在运行我的测试类时遇到错误
Error:Gradle: Execution failed for task ':app:compileDebugJava'.
> Compilation failed; see the compiler error output for details.
E:\junitTest\android-studio-robolectric-example-master\JunitTestApp\app\src\test\java\com\inapp\junittestapp\SampleTest.java
Error:(7, 17) Gradle: error: package org.junit does not exist
Error:(8, 24) Gradle: error: package org.junit.runner does not exist
Error:(9, 23) Gradle: error: package org.robolectric does not exist
Error:(10, 34) Gradle: error: package org.robolectric.annotation does not exist
Error:(11, 31) Gradle: error: package org.robolectric.shadows does not exist
Error:(13, 27) Gradle: error: package org.hamcrest does not exist
Error:(13, 1) Gradle: error: …Run Code Online (Sandbox Code Playgroud)