0
顯示文本這裏是我的代碼:搜索欄不片段
public class ScoreFragment extends Fragment {
public static final String TAG ="ScoreFragment";
@Override
public void onAttach(Activity activity) {
super.onAttach(activity);
Log.d(TAG, "onAttach");
}
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
if(savedInstanceState==null)
{
Log.d(TAG,"onCreate FIRST TIME");
}
else
{
Log.d(TAG,"onCreate SUBSEQUENT TIME");
}
}
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
super.onCreateView(inflater,container,savedInstanceState);
final View v = inflater.inflate(R.layout.score_collection, container, false);
final TextView sliderText = (TextView) v.findViewById(R.id.score_number);
sliderText.setTextSize(48);
//TODO: Find solution to find known bug in Android
/* ActionBar actionBar = ((ActionBarActivity) getActivity()).getSupportActionBar();
actionBar.hide();*/
SeekBar seekbar = (SeekBar) v.findViewById(R.id.seekBar);
seekbar.setOnSeekBarChangeListener(new SeekBar.OnSeekBarChangeListener() {
@Override
public void onProgressChanged(SeekBar seekBar, int progress, boolean fromUser) {
sliderText.setText("" + progress);
}
@Override
public void onStartTrackingTouch(SeekBar seekBar) {
}
@Override
public void onStopTrackingTouch(SeekBar seekBar) {
}
});
Log.d(TAG,"onCreateView");
return inflater.inflate(R.layout.score_collection, container, false);
}
顯示搜索欄,但不增加或顯示在我看來,任何文本。
以下是我把它架在我看來(一RelativeLayout的內線):
<SeekBar
android:layout_width="300sp"
android:layout_height="wrap_content"
android:id="@+id/seekBar"
android:progress="0"
android:max="10"
android:minHeight="30sp"
android:maxHeight="30sp"
android:layout_below="@+id/score_number"
android:layout_centerHorizontal="true"/>
它實際上之前我把它變成碎片的工作,所以我認爲這與它是一個片段裏面做,但是我不完全確定。
它假設由1遞增,以0分至10