我只是对我的布局有点问题。在这里它是:android:layout_below保持重叠视图
<RelativeLayout 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="@color/Beige"
tools:context=".HomeActivity" >
<TextView
android:id="@+id/strip_popular"
style="@style/StripsHome"
android:layout_width="match_parent"
android:text="@string/home_popular" >
</TextView>
<HorizontalScrollView
android:id="@+id/scroll_popular"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@id/strip_popular" >
<LinearLayout
android:id="@+id/popular_layout"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="horizontal" >
</LinearLayout>
</HorizontalScrollView>
<TextView
android:id="@+id/strip_latestreviews"
style="@style/StripsHome"
android:layout_width="match_parent"
android:layout_below="@id/strip_popular"
android:text="@string/home_latestreviews">
</TextView>
<HorizontalScrollView
android:id="@+id/scroll_latestreviews"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@id/strip_latestreviews" >
<LinearLayout
android:id="@+id/latestreviews_layout"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="horizontal" >
</LinearLayout>
</HorizontalScrollView>
我的问题是,第二TextView的完全重叠,而不是出现在水平滚动视图下方的第一个,。
在我的代码中插入这样的图像:
LinearLayout popular = (LinearLayout) findViewById(R.id.popular_layout);
Integer[] mThumbIds = {
R.drawable.first, R.drawable.second,
R.drawable.third, R.drawable.fourth};
for(Integer i : mThumbIds){
ImageView imageView = new ImageView(getApplicationContext());
imageView.setLayoutParams(new LinearLayout.LayoutParams(220, 220));
imageView.setScaleType(ImageView.ScaleType.CENTER_CROP);
imageView.setImageResource(i);
popular.addView(imageView);
}
什么建议吗?
你的android:layout_below = “@ ID/strip_popular” 在滚动视图和TextView的。 – Nfear