Android 图像视图下方的文本视图在小型设备中不显示
我在viewpager中的imageview下面有一个简单的文本视图: 我已经将viewpager的高度及其父布局定义为wrap_内容,但是我的imageview下面的textview在小型设备320dp中不显示。结果是IconPageIndicator位于imageview no textview下方,而不是imageview下方的textview和textview下方的IconPageIndicator 这是我的自定义textview类,请注意,我不会覆盖onMeasure: 公共类CustomTextView扩展了TextView{Android 图像视图下方的文本视图在小型设备中不显示,android,xml,android-layout,Android,Xml,Android Layout,我在viewpager中的imageview下面有一个简单的文本视图: 我已经将viewpager的高度及其父布局定义为wrap_内容,但是我的imageview下面的textview在小型设备320dp中不显示。结果是IconPageIndicator位于imageview no textview下方,而不是imageview下方的textview和textview下方的IconPageIndicator 这是我的自定义textview类,请注意,我不会覆盖onMeasure: 公共类Cust
public CustomTextView(Context context) {
super(context );
// TODO Auto-generated constructor stub
init();
}
public CustomTextView(Context context, AttributeSet attrs) {
super(context, attrs);
// TODO Auto-generated constructor stub
init();
}
public CustomTextView(Context context, AttributeSet attrs, int defStyle) {
super(context, attrs, defStyle);
// TODO Auto-generated constructor stub
init();
}
private void init() {
Typeface tf = Typeface.createFromAsset(getContext().getAssets(),"segoe_script.ttf");
setTypeface(tf);
}
}
请帮助我,谢谢你的帮助。小型设备320dp我想你把px和dp搞混了。我猜你的意思是高度小于320像素。这些设备的密度通常为120 dpi ldpi,在纵向模式下的分辨率为240*320像素。如果用基本TextView替换com.blazetama.skripsi.util.CustomTextView,会发生什么情况?在不知道CustomTextView如何测量其宽度/高度的情况下,可能很难提供帮助。@CSmith抱歉,我忘了发布自定义textview代码。更新的问题。
<ImageView
android:id="@+id/imgHeader"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/edittext_vertical_margin"
android:layout_marginLeft="@dimen/edittext_vertical_margin"
android:layout_marginRight="@dimen/edittext_vertical_margin"
android:layout_alignParentTop="true"
android:layout_centerHorizontal="true"
android:src="@drawable/title_n_instruct" />
<LinearLayout
android:id="@+id/layoutViewpager"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_above="@+id/indicatorMenu"
android:layout_below="@+id/imgHeader"
android:orientation="horizontal" >
<ImageView
android:id="@+id/imgLeft"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:layout_weight="0.2"
android:scaleType="centerCrop"
android:src="@drawable/left"
android:visibility="invisible"/>
<android.support.v4.view.ViewPager
android:id="@+id/viewPager"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="@dimen/edittext_vertical_margin"
android:layout_marginRight="@dimen/edittext_vertical_margin"
android:layout_weight="0.6" />
<ImageView
android:id="@+id/imgRight"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:layout_weight="0.2"
android:scaleType="centerCrop"
android:src="@drawable/right" />
</LinearLayout>
<com.viewpagerindicator.IconPageIndicator
android:id="@+id/indicatorMenu"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_centerHorizontal="true" />
<ProgressBar
android:id="@+id/progress"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerInParent="true"
android:visibility="gone" />
public CustomTextView(Context context) {
super(context );
// TODO Auto-generated constructor stub
init();
}
public CustomTextView(Context context, AttributeSet attrs) {
super(context, attrs);
// TODO Auto-generated constructor stub
init();
}
public CustomTextView(Context context, AttributeSet attrs, int defStyle) {
super(context, attrs, defStyle);
// TODO Auto-generated constructor stub
init();
}
private void init() {
Typeface tf = Typeface.createFromAsset(getContext().getAssets(),"segoe_script.ttf");
setTypeface(tf);
}