2016-11-27 32 views
1

在Android开发,我有一个LinearLayout如下:的ListView侧指数不适合屏幕

<?xml version="1.0" encoding="utf-8"?> 
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" 
    android:layout_width="match_parent" 
    android:layout_height="match_parent" 
    android:orientation="horizontal"> 

    <ListView 
     android:id="@android:id/list" 
     android:layout_width="0dp" 
     android:layout_weight="1" 
     android:layout_height="wrap_content" 
     android:paddingRight="0dp"/> 

    <TextView 
     android:id="@+id/text_inprogress" 
     android:layout_width="match_parent" 
     android:layout_height="match_parent" 
     android:text="Congress API"/> 

    <LinearLayout 
     android:id="@+id/side_index" 
     android:layout_width="50dp" 
     android:layout_height="fill_parent" 
     android:background="#c3c3c3" 
     android:gravity="center_horizontal" 
     android:orientation="vertical" > 
    </LinearLayout> 
</LinearLayout> 

和索引项

<TextView xmlns:android="http://schemas.android.com/apk/res/android" 
    android:id="@+id/side_list_item" 
    android:layout_width="wrap_content" 
    android:layout_height="fill_parent" 
    android:gravity="center" 
    android:padding="3dp" 
    android:textSize="12sp" /> 

我对右侧的边指数。它是A到Z.但是实际的用户界面只显示A到V,因为没有足够的空间。每个项目的填充是3.我怎样才能使边索引适合屏幕?

如果我在索引项文本视图中将填充更改为1dp,它将变得太小。我想要的只是自动适合屏幕的一面。我怎样才能做到这一点?


enter image description here

回答

0

怎么样制作的LinearLayout能够垂直滚动?如果答案是肯定的,那么继续并在linearlayout之外添加滚动视图〜